[whatwg] LABEL and radio/checkbox onclick

Olav Junker Kjær olav at olav.dk
Thu Aug 19 05:52:07 PDT 2004


>>   <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



More information about the whatwg mailing list