I have multiple checkboxes and I want to ensure that at least one of them is checked when the form is submitted. Here is the code I have:
<p><input type="checkbox" name="registrationFee[]" value="Full 2-day package: £275" id="fullRegistrationFee" eform="Registration Fee::1"/> <label for="fullRegistrationFee" class="checkboxlabel">Full 2-day package: <strong>£275</strong></label></p>
<p><input type="checkbox" name="registrationFee[]" value="Subsidised 2-day package: £200" id="subsidisedRegistrationFee" /><label for="subsidisedRegistrationFee" class="checkboxlabel">Subsidised 2-day package for students, no affiliation or third sector: <strong>£200</strong></label></p>
<p><input type="checkbox" name="registrationFee[]" value="1 day - 8th July only: £100" id="8JulyRegistrationFee" /><label for="8JulyRegistrationFee" class="checkboxlabel">1 day - 8<sup>th</sup> July only: <strong>£100</strong></label></p>
<p><input type="checkbox" name="registrationFee[]" value="1 day - 9th July only: £100" id="9JulyRegistationFee" /><label for="9JulyRegistrationFee" class="checkboxlabel">1 day - 9<sup>th</sup> July only: <strong>£100</strong></label></p>
If, to check the validation, I submit the form with none of the boxes checked, it rejects it. However, it only highlights the first three checkboxes as being required. The source code this produces is:
<p><input type="checkbox" name="registrationFee[]" id="fullRegistrationFee" class="required" value="Full 2-day package: £275" /><label for="fullRegistrationFee" class="checkboxlabel required">Full 2-day package: <strong>£275</strong></label></p>
<p><input type="checkbox" name="registrationFee[]" id="subsidisedRegistrationFee" class="required" value="Subsidised 2-day package: £200" /><label for="subsidisedRegistrationFee" class="checkboxlabel required">Subsidised 2-day package for students, no affiliation or third sector: <strong>£200</strong></label></p>
<p><input type="checkbox" name="registrationFee[]" id="8JulyRegistrationFee" class="required" value="1 day - 8th July only: £100" /><label for="8JulyRegistrationFee" class="checkboxlabel required">1 day - 8<sup>th</sup> July only: <strong>£100</strong></label></p>
<p><input type="checkbox" name="registrationFee[]" id="9JulyRegistationFee" class="required" value="1 day - 9th July only: £100" /><label for="9JulyRegistrationFee" class="checkboxlabel">1 day - 9<sup>th</sup> July only: <strong>£100</strong></label></p>
As you can see, the class "required" isn’t appended to the label in final item, although it is to the checkbox itself.
Also, and even more worryingly, if I do check one of the boxes, the validation message says: "Registration Fee » Incorrect value".
Can anyone spot what I’m doing wrong?