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

[whatwg] LABEL and radio/checkbox onclick

From: Olav Junker Kjr <olav@olav.dk>
Date: Thu, 19 Aug 2004 14:52:07 +0200
Message-ID: <4124A277.9050003@olav.dk>

>>   <p>The first submit button in a form should be the default button.
>>   If the platform supports submitting a form implicitly (for example,
>>   on some platforms hitting the "enter" key while a text field is
>>   focussed implicitly submits the form), then when doing so the first
>>   submit button should be the one used to initiate form submission
>>   (and it will therefore be <a href="#successful">successful</a>).</p>
> 
 > how is this supportable in IE6 with HTC's?

Probably by capturing key down events on text fields, and in the case of 
an enter:
1) identify the default button (first submit button in document order, 
which either has a form-attribute pointing to the form which owns the 
text field, or has no form-attribute and is a descendant of the form)
2) inserting name and value from the default button into the data set.
3) validate and submit the form.

If the built-in submission mechanism is used, the name-value-pair could 
be added to the dataset by inserting a hidden field before submitting 
the form, and removing it again immediately after.

The trick with the hidden field is perhaps ugly, but something like this 
is needed anyway, to fix the broken behavior of BUTTON-elements (which 
by default submits their content rather than their value)

Anyway, this is just a suggestion, I'm sure somebody else could come up 
with a more elegant solution. But I'm pretty sure that the feature is 
implementable, if this is what you were asking.

Olav Junker Kj?r
Received on Thursday, 19 August 2004 05:52:07 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:36 UTC