Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
09-16-2011, 09:18 PM #1
- Join Date
- May 2010
- Thanked 0 Times in 0 Posts
Can a hidden div pass on form data?
Say I have a form so long that i want to group sections by category and have them expandable, using css to display:none or display:block these groups. If a user selects an option or two in one of these divs, then fills in some fields, then hides the div... is it going to cause problems when they submit the form if the div is hidden?
edit: let me ask another question too--what if we add validation into the mix. What happens if a field in a hidden div does not pass validation?
09-17-2011, 01:16 AM #2
- Join Date
- Mar 2008
- Thanked 42 Times in 42 Posts
Answer to your first question:
It wont create any problem unless they all are within the form that will be submitted. You can and must divide large page into chunks for ease and simplification.
Answer to your second question:
Adding validation code also wont create any problem. The trick is how you will handle the failure conditions. One simplest solution is to create multiple validation methods for each group sections. So that if any hidden div does not pass the validation, you can easily identify which div you need to set visible.
Hope I have made my point clear. If you still have any confusion, please tell us.
Thanks & Regards,
09-17-2011, 02:02 AM #3
What you might consider doing is validating each VISIBLE section of the <form> *before* you make it hidden and make another one visible. That way, the user isn't surprised when, on the final screen, you pop him back to the first one to fill in his name.
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.