[whatwg] [WF2] <select required>

Ian Hickson ian at hixie.ch
Thu Oct 23 05:31:41 PDT 2008

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.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list