<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.26.3">
</HEAD>
<BODY>
On Tue, 2010-08-10 at 11:35 +0200, Mounir Lamouri wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
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
</PRE>
</BLOCKQUOTE>
<BR>
If you receive an empty text box then a required element works to validate against empty input. As you produce the input for the select list, it's pretty stupid to say that it shouldn't have an empty string for a value because you put it there.<BR>
<BR>
I can think of lots of places where an empty string is in-fact very useful for a select element, such as filters on search results forms, but if there's any places that I want a value, then I don't leave empty elements lying around. If you need to do that, then maybe use radio buttons instead.<BR>
<BR>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
Thanks,<BR>
Ash<BR>
<A HREF="http://www.ashleysheridan.co.uk">http://www.ashleysheridan.co.uk</A><BR>
<BR>
<BR>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>