hi,
If I have a <ul> made up of checkboxes of the same name (to prompt the user to select more then one choice via checkbox), how can I validate they did check off at least one option?
I tried putting the 'required' attribute in both the ul level and the input level... it either doesn't do anything, or it requires the user to check off every single check box (instead of just one or more).
Here's the HTML (this works fine with Radio buttons and Kendo BTW, you can change the type to RadioButton and see. but as checkbox, it breaks)
If I have a <ul> made up of checkboxes of the same name (to prompt the user to select more then one choice via checkbox), how can I validate they did check off at least one option?
I tried putting the 'required' attribute in both the ul level and the input level... it either doesn't do anything, or it requires the user to check off every single check box (instead of just one or more).
Here's the HTML (this works fine with Radio buttons and Kendo BTW, you can change the type to RadioButton and see. but as checkbox, it breaks)
<form>
<!-- in this case, I set required at the ul level !-->
<ul required="required" validationMessage="You must enter a gender">
<li>
<input id="male" name="mf" type="checkbox" value="Male" />
<label for="male">Male</label>
</li>
<li>
<input id="female" name="mf" type="checkbox" value="Female" />
<label for="female">Female</label>
</li>
</ul>
<!-- in this case, I set it at the input level -->
<ul required="required" validationMessage="You must enter a gender2">
<li>
<input id="male2" name="mf2" type="checkbox" value="Male2" required />
<label for="male">Male2</label>
</li>
<li>
<input id="female2" name="mf2" type="checkbox" value="Female2" required />
<label for="female">Female2</label>
</li>
</ul>
<input type="submit" value="submit">
</form>
thanks!