[whatwg] select element should have a required attribute

"Tab Atkins Jr." <jackalmage at gmail.com> schrieb am Tue, 10 Aug 2010
11:25:55 -0700:

> 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).

Keep in mind, that for legacy UAs, that input will *not* fail
validation. So the problem is already there.

> 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 think I'd prefer the simple solution of having it fail @required
> validation in the same way that text inputs do - when their value is
> the empty string.

Overloading the string value to me seems to be more magic, especially
in light of the fact that there are legitimate use cases of selecting
an empty string ? I am currently working on a Wordpress plugin, where a
<select> is used to select (hehe) the locale for an REST API call.
Setting the locale to an empty string is not an error, it just returns
unlocalized results.

Not having @placeholder on <select> may be a bit simpler to implement,
but having it would be more consistent for authors and users alike.


Cheers,
-- 
Nils Dagsson Moskopp // erlehmann
<http://dieweltistgarnichtso.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 230 bytes
Desc: not available
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20100810/ca4b1e75/attachment.pgp>

Received on Tuesday, 10 August 2010 11:51:10 UTC