Long-Term Stackoverflow Reader; first time, so hope you will be gentle :)
I have a form on a page consisting of 50 fields of various types (flags / text / decimal / date, etc.). Values are pulled from about 8 tables through a single query like this:
SELECT * FROM p
LEFT JOIN pd on p.id=pd.id
LEFT JOIN pc on p.id=pc.id
LEFT JOIN pie on p.id=pie.id
etc.
WHERE p.id = xxx
I started the day thinking that I was just using a simple POST in the form, I would write a bunch of validation and update questions (overriding every existing value with what is in the form), and do it, but I'm asking for my judgment here.
In particular, it feels wrong, overriding the existing value if it hasn't changed, and I'm a little worried about what happens if the db update doesn't go halfway (thinking about handling this with transactions). I like it on smaller forms, but if the staff changed only 1 or 2 fields, it looks like a lot has been written for nothing. Then my next thought was to make it AJAX field-based. Changing any field transfers the change and saves it. Feels like this can make more sense, even if I would rather avoid js, if I could. The third option, of course, is to turn it into several forms with several submit buttons, say, one per tab (the form is already divided into tabs), and the drawback is when you reload the page more often,since she needs to send more (although here, too, of course, AJAX).
( , ...)?! , - , , - , ?
--- ---
SO, , , , , , . .
, barnyr, javascript , mysql ( jquery post). , , :
jquery serialize / , . , . http://tdanemar.wordpress.com/2010/08/24/jquery-serialize-method-and-checkboxes/, .
, , , " " , , . , , . , , , " submit", , , , .
, , , , . , 2 , , , . ( ), , , , . , .
, , AJAX , , , save, , , , , AJAX, , .
2,3 4 , , , , , , , submit, , , :) , , .