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

[whatwg] [Web Forms 2.0] 2.3. Extensions to the select element - comment & proposal

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Mon, 27 Aug 2007 13:55:17 -0700
Message-ID: <c9e12660708271355y5f2f1027pe482d4023f481a24@mail.gmail.com>
================================================================
2.3. Extensions to the select element

Previous versions of Web Forms were inconsistent about whether the
first option element of a single-select select element with no
otherwise-selected items should be automatically selected. According
to [RFC1866], it should be, and according to [HTML4] it was undefined.
User agents implementing this specification must select the initial
option element of a single-select select element with no
otherwise-selected items.
================================================================

I would like the defaultSelected for this behavior to be true.

Currently there is a problem in at least Firefox, and I can't remember
about IE. If no OPTION has selected attribute, then Firefox will
select the first option in the list. If the first option is selected,
it's selected attribute will be true and the defaultSelected will be
false. This is because defaultSelected is required to return the value
of the HTML selected attribute.

The negative result this has is that it causes the form to appear dirty.

Form dirty notification is quite useful in modern Ajax applications.
In fact, it is useful to broadcast a custom "dirty" event from a FORM
wrapper class (ES). That way, subscribers can listen for the event and
enable a submit button, for example.

I have implemented this particular example use-case and run into the
very problem. The solution was to require the clients (other
developers using the FORM wrapper code) to explicitly use the selected
attribute.

My proposal is to change the text as follows:
================================================================
2.3. Extensions to the select element

Previous versions of Web Forms were inconsistent about whether the
first option element of a single-select select element with no
otherwise-selected items should be automatically selected. According
to [RFC1866], it should be, and according to [HTML4] it was undefined.
User agents implementing this specification must select the initial
option element of a single-select select element with no
otherwise-selected items ***and set its defaultSelected value to
true.***
================================================================

Garrett

-- 
http://dhtmlkitchen.com/
Received on Monday, 27 August 2007 13:55:17 UTC

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