[whatwg] select element should have a required attribute
Tab Atkins Jr.
jackalmage at gmail.com
Tue Aug 10 10:08:22 PDT 2010
On Tue, Aug 10, 2010 at 2:35 AM, Ashley Sheridan
<ash at ashleysheridan.co.uk> wrote:
> If you receive an empty text box then a required element works to validate against empty input. As you produce the input for the select list, it's pretty stupid to say that it shouldn't have an empty string for a value because you put it there.
You're missing the point. We don't put that value there for it to be
picked; we put it there *precisely because it shouldn't be picked*,
and it's a signal to the user that they need to choose an *actual*
> I can think of lots of places where an empty string is in-fact very useful for a select element, such as filters on search results forms, but if there's any places that I want a value, then I don't leave empty elements lying around.
Yes? And when that's valid, you should just *not use @required*, same
as when an empty string is a valid value for an <input type=text>.
> If you need to do that, then maybe use radio buttons instead.
It's okay to replace a radio button with a checkbox when you need that
functionality instead, because the two are nearly identical in
presentation. It's not generally okay to replace a <select> with a
radio button group, because the two are vastly different
More information about the whatwg