NOTE: The current preferred location for bug reports is the GitHub issue tracker.
Bug 50 - Investigate if radio and checkbox inputs need a non-empty value
Investigate if radio and checkbox inputs need a non-empty value
Status: NEW
Product: Validator.nu
Classification: Unclassified
Component: HTML5 schema
HEAD
All All
: P2 normal
Assigned To: Nobody
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-02-23 15:02 CET by Henri Sivonen
Modified: 2012-09-14 12:44 CEST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Henri Sivonen 2008-02-23 15:02:53 CET
Do not know if radio buttons and checkboxes should be required to have a non-empty value.
Comment 1 Alan Jenkins 2012-09-14 12:44:13 CEST
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".