Sample proposed usages of select with @required and supporting attributes

See [whatwg] [WF2] <select required> discussion.

select with first option as hint

In Firefox and MSIE, since the 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.

Example of a proposed unselected attribute

By default, the first option in a select is selected; the only way to select no option, is to set select.selectedIndex = -1. It would seem quite useful if some non-scripting means of doing this; perhaps an "unselected" boolean attribute would make sense. Unfortunately, Safari still submits the first option as the value. What follows is a prototype (note that this prototype works badly if user reloads page or comes back to it from another page, since their selected value is lost):


@required is intuative with select@multiple

The requried attribute here absolutely makes sense because no value is by default selected, and even if one is selected, it may be de-selected with Ctrl+Click (or equivalent).



Weston Ruter, Shepherd Interactive
October 2008