- From: Weston Ruter <westonruter@gmail.com>
- Date: Thu, 23 Oct 2008 07:21:54 -0700
Many times I've set SELECT.selectedIndex to -1 to have the effect of an invalid starter value; I think this is a case where the REQUIRED attribute would make sense. If a SELECT has a REQUIRED attribute, and SELECT.selectedIndex == -1, then the control would be considered invalid. It would also seem to be beneficial to have some non-scripting means of setting SELECT.selectedIndex to -1. Perhaps an "UNSELECTED" boolean attribute, as in <select unselected> Weston On Thu, Oct 23, 2008 at 5:31 AM, Ian Hickson <ian at hixie.ch> wrote: > 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. `._.-(,_..'--(,_..'`-.;.' > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20081023/9d07b703/attachment.htm>
Received on Thursday, 23 October 2008 07:21:54 UTC