Bugzilla – Bug 50
Investigate if radio and checkbox inputs need a non-empty value
Last modified: 2012-09-14 12:44:13 CEST
Do not know if radio buttons and checkboxes should be required to have a non-empty value.
Checkboxes in forms work without a value (it just won't make much sense if you have more than one with the same name and no value). I tested it in Firefox 15. I don't see such a _requirement_ anywhere. You're allowed to use inputs outside of forms. In that case you could identify them by id only - and it would probably be most convenient to do so. Radio buttons in forms - maybe as a warning. You're not allowed to have a radio button with a name attribute on its own; there MUST be at least two with the same name. You could check that first - then warn if the values are not all unique[1]. The empty value is not a special case in that respect. Another warning could be for radio buttons with no name. (Radio buttons which don't belong to a radio group are pretty pointless). [1] <http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#radio-button-group> "A document must not contain an input element whose radio button group contains only that element".