Web Forms 2.0 Test Case 21: "required" attribute on checkboxes and radio buttons

This test case demonstrates functionality of the Web Forms 2.0 specification and tests the compliance of this cross-browser Web Forms 2.0 implementation.

The specification states:

For checkboxes, the required attribute shall only be satisfied when one or more of the checkboxes with that name in that form are checked.

For radio buttons, the required attribute shall only be satisfied when exactly one of the radio buttons in that radio group is checked.

Specifying a required attribute on a checkbox only makes sense when there are multiple checkboxes defined to be in a group by providing each with the same name attribute (as the quote from the specification makes reference to). In Opera 9.23 when a required attribute is specified on either one or all radio buttons in a group, the form validates if one of the buttons is checked. With regard to a group of checkboxes, however, when the required attribute is defined on one checkbox, that one specific checkbox must be checked in order for the form to validate in Opera. If the required attribute is defined on all checkboxes in the group, then the form only validates if every checkbox is checked. Opera's implementation, then, is faulty, since it does not make sense to present the user with a single checkbox that must always be checked, and since the specification states that UAs must apply the required attribute onto the entire group of checkboxes, not every single one individually.

←  | Test Suite Index

required attribute set all controls in a group

Favorite color:

Favorite food:

required attribute set on last control of a group

Favorite color:

Favorite food:


Web Forms 2.0 implementation
Version: 0.5.2 (2007-11-29) changelog
Weston Ruter