I am creating checkboxes in an HTML Form using a dynamic loop (for which I am using ASP). Since it is dynamic, I am not aware of how many checkboxes will be ultimately present when the user submits the Form. The name & the value of these checkboxes is "contact" followed by a unique ID i.e. each checkbox will have a unique name & value. Examples of these checkboxes can be something like this:
<input type=checkbox name="contact89" value="contact89">
<input type=checkbox name="contact234" value="contact234">
<input type=checkbox name="contact6" value="contact6">
<input type=checkbox name="contact111" value="contact111">
As you can see, the name & the value are unique for each checkbox but both name & value of all the checkboxes are preceded by 'contact'. While coding, I am only aware that the name & value are preceded by 'contact' but I don't know the ID of the checkboxes which makes it unque. How do I validate that only one checkbox is checked when the user submits the Form? Also if there is one & only one checkbox, how do I validate that that checkbox is checked?
Thanks,
Arpan
<input type=checkbox name="contact89" value="contact89">
<input type=checkbox name="contact234" value="contact234">
<input type=checkbox name="contact6" value="contact6">
<input type=checkbox name="contact111" value="contact111">
As you can see, the name & the value are unique for each checkbox but both name & value of all the checkboxes are preceded by 'contact'. While coding, I am only aware that the name & value are preceded by 'contact' but I don't know the ID of the checkboxes which makes it unque. How do I validate that only one checkbox is checked when the user submits the Form? Also if there is one & only one checkbox, how do I validate that that checkbox is checked?
Thanks,
Arpan