During my adventures trying to get a <select required="required">
to actually be required, I discovered:
If a select element has a required attribute specified, does not have a multiple attribute specified, and has a display size of 1; and if the value of the first option element in the select element's list of options (if any) is the empty string, and that option element's parent node is the select element (and not an optgroup element), then that option is the select element's placeholder label option.
So I changed my markup to mirror that:
<select required="required" ...>
<option value="">--</option>
...
</select>
But unfortunatley it rendered as:
<select required="required" ...>
<option>--</option>
...
</select>
And because value=""
was stripped out, it no longer meets the specification for <select required="required">
, and the form can be submitted with no value selected.
How can I get the value=""
attribute specification to stick?