- From: Jonas Sicking <jonas@sicking.cc>
- Date: Mon, 9 Aug 2010 18:10:28 -0700
On Mon, Aug 9, 2010 at 5:26 PM, Ashley Sheridan <ash at ashleysheridan.co.uk> wrote: > > On Mon, 2010-08-09 at 16:54 -0700, Jonas Sicking wrote: > > On Mon, Aug 9, 2010 at 4:35 PM, Ian Hickson <ian at hixie.ch> wrote: > > On Fri, 18 Jun 2010, Mounir Lamouri wrote: > >> > >> I'm wondering why select element do not have a required attribute. > > > > It's impossible to submit a <select> element (without a size="" attribute > > or multiple="" attribute) without it having a value -- essentially, > > required="" is already implied. > > > > > > On Thu, 22 Jul 2010, Mounir Lamouri wrote: > >> > >> 1. A typical use case of <select> is to have <option value=''>Choose an > >> option</option> as a default value. Having @required would prevent > >> authors to write any js check when they are using <select> like that. > > > > That seems like an invalid use of <option> to me. It would be better as: > > > > ? <label> Choose an option: <select> ... </select> </label> > > Many times you want the user to make an explicit choice, rather than > just leaving whatever was already selected. What many websites do is: > > <label>Choose an option: > <select> > <option></option> > <option>value 1</option> > <option>value 2</option> > <option>value 3</option> > </select> > </label> > > Or > > <select> > <option value="">Choose an option:</option> > <option>value 1</option> > <option>value 2</option> > <option>value 3</option> > </select> > > It would be good if it was possible to use @required together with > these usage patterns. I don't believe that any other feature of HTML > supplies the same, or similar, functionality? While authors could do > > <label>Choose an option: > <select> > <option>value 1</option> > <option>value 2</option> > <option>value 3</option> > </select> > </label> > > I think there is a reason they haven't done so so far, and I don't see > that HTML5 changes any of those reasons. > > While I guess we could wait for v2 for this feature, it seems like a > glaring omission and inconsistency in the way that @required works. > > / Jonas > > This is wrong in my opinion, it just doesn't make sense to have loads of empty elements. Select lists get used for a lot of wrong things sometimes, such as a year picker (of which there are many tales on the daily wtf where the data range just isn't well thought out) I don't really understand what you are proposing. Many sites seem to want to have users make an explicit choice. What do you propose that they do? / Jonas
Received on Monday, 9 August 2010 18:10:28 UTC