[whatwg] required attribute for checkbox/select

Matt Wright mw at mattwright.com
Mon Feb 21 13:47:24 PST 2005


Sorry if these items have already been discussed on the mailing list, but I
searched the archives and didn't see anything. I had a couple suggestions
for the required attribute (section 2.7) in Web Forms 2.0.

1) For checkboxes, wouldn't it would make more sense from a web applications
standpoint if this applied to a checkbox group like radio buttons currently
does?

	OLD: "For checkboxes, the required attribute shall only be satisfied
when the checkbox is checked."

	NEW: "For checkboxes, the required attribute shall only be satisfied
when one or more of the checkboxes in that checkbox group is checked."

If authors want the behavior currently specified in the draft, they simply
name that checkbox something different from all other fields in the form.

2) Why can't the required attribute apply to a select field?  It is common
for application designers to want to force the user to manually select an
option.  They will do something like <option value="">Please select a valid
option</option>. You could easily word the document to say that:

	NEW: "For select, the required attribute shall only be satisfied
when a non-empty option value is selected."

Or, you may not even need to re-word the document, but just remove select
from the list of unsupported controls, since the final catch-all of this
section explains "Any non-empty value satisfies the required condition,
including a simple whitespace character."

Thanks,

Matt Wright




More information about the whatwg mailing list