views:

38

answers:

2

Hi,

I have a fairly complex html form enhanced via jquery. It has multiple tabs, within each one things like a html form builder, uploads, descriptions.

There is lots of data, and as the user flicks around the various tabs I'm thinking of posting the data to the server. For example, the form builder, has about 10 properties for each field, as the user flicks between the various fields, an ajax request saves the current values, then loads a new set from the new field clicked on.

When the user hits save, the idea is then on the server all these bits and pieces come together and become the live version (i may store them as a temp version while the user is working away).

So I guess my question is, for complex forms where the same fields are re-used within the one form, does anyone attempt to save all this data locally and upload it in one hit or do most of you do little ajax post's and compile it all when the final save button is hit?

b

A: 

It might depend on how the object model is designed and validated. Is it one large object? Or an object tree/graph of some sort? If the latter, then maybe partial trees or some of the smaller objects can be persisted on the server and validated easily enough. if it's one big object, then maybe it will be a good idea to keep the data on the page and POST (and validate on the server) in one hit. I'd suggest the 1st option tho - smaller pieces is good everywhere in a design. It will help you debug easier too.

cottsak
Yeah its a case of a lot of sub-records in the form. i.e main form, the a sub form of html fields, (sub-objects). Just seems like a lot of hassle to write all the logic to store this in arrays locally and drag them in and out of the ui
Brett
+1  A: 

You should do it as a single post, this way the form will still have a way of working with no Javascript. Then you can save intermediate steps to the server, so that in case of any trouble, a lot of user input is not lost.

Much depends on the specifics of your form, but I'd suggest AJAX services to save/load form state, then an actual POST to do the final send.

levik
Yeah its a case of a lot of sub-records in the form. i.e main form, the a sub form of html fields, (sub-objects). Just seems like a lot of hassle to write all the logic to store this in arrays locally and drag them in and out of the ui
Brett