[whatwg] select element should have a required attribute

Mounir Lamouri mounir.lamouri at gmail.com
Tue Aug 10 02:35:21 PDT 2010

On 08/10/2010 07:09 AM, Garrett Smith wrote:
>> Many times you want the user to make an explicit choice, rather than
>> just leaving whatever was already selected. What many websites do is:
>> <label>Choose an option:
>>   <select>
>>     <option></option>
>>     <option>value 1</option>
>>     <option>value 2</option>
>>     <option>value 3</option>
>>   </select>
>> </label>
> The first option should be selected, resulting in the select having
> value="". If `required` is specified, and the user selects an empty
> option (the first option in the list) and submits the form, what do
> you think should happen?

Like for <input> or <textarea>, if select.value is the empty string, the
select element suffers for being missing.

>> Or
>> <select>
>>   <option value="">Choose an option:</option>
>>   <option>value 1</option>
>>   <option>value 2</option>
>>   <option>value 3</option>
>> </select>
> What should happen if the SELECT has `required`?



More information about the whatwg mailing list