W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2010

[whatwg] select element should have a required attribute

From: Mounir Lamouri <mounir.lamouri@gmail.com>
Date: Tue, 10 Aug 2010 11:35:21 +0200
Message-ID: <4C611D59.6080304@gmail.com>
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`?

ditto

--
Mounir
Received on Tuesday, 10 August 2010 02:35:21 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:59 UTC