[whatwg] select element should have a required attribute

Gordon P. Hemsley gphemsley at gmail.com
Fri Jun 18 09:58:29 PDT 2010


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.

Thus, as you've said, Ash, there will always be some sort of value sent from
a <select> element. And, including the option of an empty string, I can't
think of any way that there wouldn't be a value sent.

Gordon

On Fri, Jun 18, 2010 at 7:04 AM, Ashley Sheridan
<ash at ashleysheridan.co.uk>wrote:

>  On Fri, 2010-06-18 at 11:35 +0200, Mounir Lamouri wrote:
>
> Hi,
>
> I'm wondering why select element do not have a required attribute. It
> seems to be perfectly suitable. With the required attribute, select
> element would be able to suffer from being missing and the :required
> pseudo-class could apply.
>
> Is there a reason why the select element has no required attribute or
> it's only an omission?
>
> Related bug:http://www.w3.org/Bugs/Public/show_bug.cgi?id=9625
>
> Thanks,
> --
> Mounir
>
>
> Required as in it should always have a value sent? If so, then it always
> does. The default value for a select element is not an empty string as an
> <option> is always there (unless someone has been stupid enough to create an
> empty select list.)
>
> As such, some sort of value will always be sent.
>
>   Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>


-- 
Gordon P. Hemsley
me at gphemsley.org
http://gphemsley.org/http://gphemsley.org/blog/
http://sasha.sourceforge.net/http://www.yoursasha.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20100618/cdcbb392/attachment-0002.htm>


More information about the whatwg mailing list