I have a web page with a form with text elements and textarea elements. Some of these input elements are used to change data in other input elements, for example, imagine that you fill in a zip code in one field it sets the state name in another field, even though you can edit the state name directly as well. (I'm simplifying; it's a very complicated form with hundreds of input elements and lots of JavaScript controlling interactions among them, like a tax form.)
There's a lot of data on the form, so for performance reasons when the user submits the form I want some of the input elements to be submitted but not others, without the user seeing anything change. With my zip code example, let's say I want the state name to be submitted to the server but not the zip code.
To distinguish input elements that are to be submitted from input elements not to be submitted I can assign style classes or use a JavsScript array with the element names.
Approaches I ruled out
I could program the server code to ignore unwanted elements but that defeats the performance improvement I'm after.
I can't put the elements I want in one <form> and the other elements in another <form> because they are intermixed all over the page, not in separate sections of the page.
I could put the elements on two separate Z layers, but I don't see any way to get the layout to come out right since elements flow across and down the page.
I can't have jQuery simply remove the unwanted elements from the page in reaction to the Submit action because the user would see the page collapse.
If I set the unwanted elements to "disabled" they won't submit, but the user can't edit them. If I wait until the user clicks Submit and then change them to "disabled", they dim visibly on the screen.
I don't know a way to put something on the form that looks and acts like a text field or textarea without it being a form element. And of course each browser has its own visible style for form elements.
I assume it's illegal to omit the name attribute or use name="" on elements that I'm not interested in, even if that would prevent them from being submitted with the form.
When the user clicks Submit I could have JavaScript construct a duplicate copy of the form, with only the wanted elements, and submit that form instead of the original one. But copying all that data would itself cause a performance hit.
So?
Does anybody have an idea about what approach might I take to doing what I want? Or is it impossible?
There's a lot of data on the form, so for performance reasons when the user submits the form I want some of the input elements to be submitted but not others, without the user seeing anything change. With my zip code example, let's say I want the state name to be submitted to the server but not the zip code.
To distinguish input elements that are to be submitted from input elements not to be submitted I can assign style classes or use a JavsScript array with the element names.
Approaches I ruled out
I could program the server code to ignore unwanted elements but that defeats the performance improvement I'm after.
I can't put the elements I want in one <form> and the other elements in another <form> because they are intermixed all over the page, not in separate sections of the page.
I could put the elements on two separate Z layers, but I don't see any way to get the layout to come out right since elements flow across and down the page.
I can't have jQuery simply remove the unwanted elements from the page in reaction to the Submit action because the user would see the page collapse.
If I set the unwanted elements to "disabled" they won't submit, but the user can't edit them. If I wait until the user clicks Submit and then change them to "disabled", they dim visibly on the screen.
I don't know a way to put something on the form that looks and acts like a text field or textarea without it being a form element. And of course each browser has its own visible style for form elements.
I assume it's illegal to omit the name attribute or use name="" on elements that I'm not interested in, even if that would prevent them from being submitted with the form.
When the user clicks Submit I could have JavaScript construct a duplicate copy of the form, with only the wanted elements, and submit that form instead of the original one. But copying all that data would itself cause a performance hit.
So?
Does anybody have an idea about what approach might I take to doing what I want? Or is it impossible?