Radio Buttons

Form Validation: Require at Least One Checkbox Before Submit

This is a simple way to force a user to make a selection from a fieldset of checkboxes in order to submit a form. With a little jQuery magic, it's actually quite easy.

To keep you from wondering whether what you find here is applicable to your specific use, here's a quick overview of what we want to accomplish. We'll start with a set of radio-buttons; one of these will be used to show a hidden fieldset of checkboxes. From there, it's crucially important that users select at least one of these checkboxes before submitting our form; we'll use jQuery to set up some validation rules to ensure this happens.

Note: we could use pure JavaScript for this, but jQuery is in my experience a lot simpler to use when capturing checked values as variables.