[whatwg] [WF2] <select required>

The official documentation for the
<http://msdn.microsoft.com/en-us/library/ms533732(VS.85).aspx> disabled
Property (BUTTON, INPUT type=button, INPUT type=checkbox, ...): contains the
following:

Note  For  <http://msdn.microsoft.com/en-us/library/ms535876(VS.85).aspx>
OPTGROUP and  <http://msdn.microsoft.com/en-us/library/ms535877(VS.85).aspx>
OPTION, the functionality specified by the
<http://www.w3.org/tr/rec-html40/> HTML 4.0 World Wide Web link standard is
not currently implemented. You can define your own functionality.

 

  _____  

From: whatwg-bounces@lists.whatwg.org
[mailto:whatwg-bounces at lists.whatwg.org] On Behalf Of Weston Ruter
Sent: Friday, October 24, 2008 9:40 PM
To: whatwg at whatwg.org
Cc: Ian Hickson; Tab Atkins Jr.; Joao Eiras; Simon Pieters; Robert
Subject: Re: [whatwg] [WF2] <select required>

 

I just realized that there is existing support for using a first OPTION as a
non-selectable hint value. Instead of this:

<select>
  <option value="[[invalid]]">Select one</option>
  <option value="">None of these</option>
  <option value="love it">Love It</option>
  <option value="hate it">Hate It</option>
</select>


One may set two attributes, @disabled and @selected, on the first OPTION:

<select>
  <option disabled selected>Select one</option>
  <option value="">None of these</option>
  <option value="love it">Love It</option>
  <option value="hate it">Hate It</option>
</select>


The behavior in browsers is that "Select one" is displayed as the value in
the drop-down, and in MSIE it's even grayed out. In Firefox and MSIE, since
the default selected option is disabled, it will not submit a value. In this
case, the option's @value makes no difference and can be an empty string or
any value at all. (Note that Firefox is a little buggy in that when clicking
on the select list, the shown selected option won't change but the value
submitted will change to the first non-disabled value.) Unfortunately,
Safari and Opera submit the disabled option, even though it cannot be
selected by hand. In IE and Firefox, once the one of the options is selected
by the user, they are unable to re-select the disabled option, as with
Safari and Opera. 

Here's a demo:
http://weston.ruter.net/projects/test-cases/html-select-element/




 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20081024/1c4e83ed/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 117 bytes
Desc: not available
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20081024/1c4e83ed/attachment.gif>

Received on Friday, 24 October 2008 12:52:30 UTC