W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2008

[whatwg] [WF2] <select required>

From: Ian Hickson <ian@hixie.ch>
Date: Thu, 23 Oct 2008 12:31:41 +0000 (UTC)
Message-ID: <Pine.LNX.4.62.0810231147010.1237@hixie.dreamhostps.com>
On Mon, 2 Oct 2006, Simon Pieters wrote:
> 
> The required="" attribute doesn't apply to <select>s in the current 
> draft of WF2. As an author I'd expect it to apply to <select>.
> 
> I've seen a case where a <select> is used and the user is required to 
> change its value, as in:
> 
>   <select name="test" required>
>    <option value="">Select one:
>    <option>Foo
>    <option>Bar
>   </select>
> 
> Now this can be done with radio buttons instead, but why can't the above 
> be supported? That is, make required apply to <select>s and if the value 
> is empty then required is not satisfied. (Same for <select multiple>.)
> 
> (I realise that radio buttons and checkboxes satisfy required even if 
> the value is empty.)

On Wed, 4 Oct 2006, Robert wrote:
>
> Submitting an empty value may be wanted, and since a select by 
> definition is a list of predefined valid values, it would make little 
> sense to prevent the user from selecting some of them. However, I agree 
> with the use case of the invalid starter value so users must consciously 
> select a value they wanted instead of the default one.

This use case is definitely something we want to consider, but I don't 
think it's about required="". It's about an option in the <select> being a 
non-option (as it were). <select> by definition can't have nothing 
selected. That's what it means.

The issue about a placeholder value is listed as an open issue in the 
spec, and will probably be addressed at some future point.

I hope this addresses your comments satisfactorily.

Cheers,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Thursday, 23 October 2008 05:31:41 UTC

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