I have divided form in to two sections: sec1 and sec2. Each section is part of a div named as sec1Div and sec2Div. Based upon some selection one of div is hidden. But the problem is that still fields in hidden section are submitted. Please suggest a way so that all of fields in a div are not submitted on submit.
I have divided form in to two sections: sec1 and sec2 . Each section
Share
There are several ways to do that. You can hook a function to the form
submit‘s event, or you can remove thenameattributes of the fields inside the hidden div. You can also disable the fields, by settingdisabled="disabled".If you are using jQuery, you can do those examples.
To disable all fields in the hidden div, you can do something like:
And, the appropriate show div function:
Please remind that this is just a code example. But you can take the idea from that.