02-27-2011, 05:14 AM
Hi
I am building a form in my prefix_newthread template using XThreads custom fields, and I am a bit stuck on the validation of the form.
I have a select box (values are Yes or No). Default value is No, div id is "cerem". When the value YES is selected then another div on the page (div id "cerem2") opens showing a second select box(values 0,1,2). (It would be nice to be able to CLOSE that div if they then choose NO after all, but thats a nice to have, not a must have).
The idea is if the answer NO is inputted then the user should not choose a number. But they can still choose a number with NO selected. What I would like is that when the user submits the form then if there are combinations such as
No and a number greater than 0
or
Yes and 0
that the page will not submit but instead will give an error (like the error we get if we try to upload an invalid attachment).
This combination of Yes and No (with different ids) occurs 4 times on the page -
Is this possible? If so, can anyone give me some pointers on how to achieve this? I have added a picture of the form....
I am building a form in my prefix_newthread template using XThreads custom fields, and I am a bit stuck on the validation of the form.
I have a select box (values are Yes or No). Default value is No, div id is "cerem". When the value YES is selected then another div on the page (div id "cerem2") opens showing a second select box(values 0,1,2). (It would be nice to be able to CLOSE that div if they then choose NO after all, but thats a nice to have, not a must have).
The idea is if the answer NO is inputted then the user should not choose a number. But they can still choose a number with NO selected. What I would like is that when the user submits the form then if there are combinations such as
No and a number greater than 0
or
Yes and 0
that the page will not submit but instead will give an error (like the error we get if we try to upload an invalid attachment).
This combination of Yes and No (with different ids) occurs 4 times on the page -
Is this possible? If so, can anyone give me some pointers on how to achieve this? I have added a picture of the form....