[whatwg] select element should have a required attribute

Ashley Sheridan ash at ashleysheridan.co.uk
Fri Jun 18 10:19:12 PDT 2010


On Fri, 2010-06-18 at 13:03 -0400, Eitan Adler wrote:

> 
> 
> On Fri, Jun 18, 2010 at 12:58 PM, Gordon P. Hemsley
> <gphemsley at gmail.com> wrote:
> 
>         I'm not sure how you interpreted, but I wanted to clarify, in
>         case it wasn't clear.
>         
>         I'm pretty sure this person is asking why @required isn't
>         allowed on <select> elements.
>         
>         As in:
>         http://dev.w3.org/html5/markup/forms-attributes.html#shared-form.attrs.required
>         
>  
>         
>         
>         I don't know what the exact reasoning is for it not being on
>         there, nor do I know exactly how @required is supposed to be
>         enforced, but I do think that the method suggested in the bug
>         is a bad one. Sometimes, authors will include an empty
>         <option> on purpose in order to allow for an empty option to
>         be selected.
>         
> 
> Perhaps the @requires attribute could be handled somewhat differently.
> If present the "default" value becomes the "not allowed" value and the
> browser would require you to change the value before submitting the
> form.
> 
> 
> 
> -- 
> Eitan Adler


I would think it makes more sense for the app/site to choose a sensible
default value. For instance, instead of the daft "-- please select a
month--" type of options, how about just picking January by default and
then letting the user override it? It's what I do on all my apps, and
makes sense to me that if the user isn't bothered about changing the
value, I only need care about whether it's a sensible value, and not
whether it was actually a conscious choice.

Thanks,
Ash
http://www.ashleysheridan.co.uk


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20100618/e2855e07/attachment-0002.htm>


More information about the whatwg mailing list