bboyle / form-validation

Validation UI for web forms
MIT License
2 stars 1 forks source link

Do required checkboxes work? #20

Closed bboyle closed 12 years ago

bboyle commented 12 years ago

Create a set of checkboxes and make them required.

Is the validation performed? Does validation still work for other form fields?

bboyle commented 12 years ago

https://github.com/Forces/form-validation/blob/master/src/jquery.forces.forms.js#L65

Need to support :checkbox along with :radio on line 65.

bboyle commented 12 years ago

You can't use @required to require a user make "1 or more selections" from a checkbox group. If you specify @required on a checkbox, then that checkbox must be checked or it is invalid. This is useful only for single checkboxes like "you must agree to the terms and conditions" (although I might contend that's not great UX in any case).

To require a min (or max) number of selections from a checkbox group, use .setCustomValidity()