W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2010

[whatwg] select element should have a required attribute

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 10 Aug 2010 10:08:22 -0700
Message-ID: <AANLkTimuY5_eMsR0YRa9d-Nkw51S_EHAmNwRqrAZ3_K2@mail.gmail.com>
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

Received on Tuesday, 10 August 2010 10:08:22 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:26 UTC