I have a HTML form which can dynamically expand and can end up with 400+ input capable fields on it.
I would like to selectively decide which fields are posted when the form is submitted (Not by AJAX) so that only fields where the values have changed are submitted.
I know that only input fields that have a name attribute are actually posted so my idea is to take each element Id (that has changed) and add a name attribute using JQuery like so:-
$(‘#field1’).attr(‘name’, ‘field1’);
This would be just before the submit and so (in theory) only the fields that have changed are submitted.
I have trawled through Google looking for examples that do this but suprisingly can’t find any examples anywhere. The closest I have seen is someone mentioning to disable fields before Submit.
So my questions are:-
Will this idea work?
If so, are there any negative reasons for using this approach?
Thanks in advance for any help.
When any input field has changed, the id gets added to field as its name.
For the general desgin issue, I would probably submit the whole form, and only update changed fields server side – it would actually be handled by hibernate in my case.