[whatwg] select element should have a required attribute
mikko.rantalainen at peda.net
Wed Aug 11 02:03:48 PDT 2010
2010-08-10 21:25 EEST: Tab Atkins Jr.:
> On Tue, Aug 10, 2010 at 11:12 AM, Mike Wilcox <mike at mikewilcox.net> wrote:
>> This seems like the ideal situation to use a placeholder attribute:
>> <select required="true" placeholder="Select an item...">
>> <option value="Foo"> Foo </option>
>> <option value="Bar"> Bar </option>
>> <option value=""> None </option>
> Almost, but not quite.
> Yes, the value used in this situation is essentially a placeholder
> value - it performs the same function as <input placeholder>.
> However, an <input type=text placeholder=foo required> will fail
> validation if the user doesn't interact with it, while a similar
> <select> will not at the moment (it will just submit the first value).
> It could be possible to define the interaction of <select>,
> @placeholder, and @required in such a way that it works intelligently,
> so that the <select> with a placeholder fails validation if the user
> doesn't interact with it, but that may be too much magic.
I would prefer something like this:
<option value="myvalue">Select an item...</option>
That is, the author should explicitly specify that the item with the
special value will not be accepted.
Stuff I don't want to see (combined with @required):
- first option is always special
- empty string as the value is special
- option without a value is special
If there needs to be some easier way to specify this but the pattern,
how about @disallow="xyz"?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 198 bytes
Desc: OpenPGP digital signature
More information about the whatwg