Closed Bug 190559 Opened 22 years ago Closed 21 years ago

[FIXr]checkbox and radio do not submit by clicking submit button

Categories

(Core :: Layout: Form Controls, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla1.7alpha

People

(Reporter: john, Assigned: bzbarsky)

References

(Blocks 1 open bug)

Details

Attachments

(3 files, 1 obsolete file)

When you hit enter on a checkbox or radio button, it submits the form but does
not click any submit button.  Pressing enter in an input submits by clicking a
submit button, so these should click the same one and use the same algorithm. 
IE exhibits the desired behavior.
Attached file Testcase
Focus a checkbox and hit enter.  A "clicked" alert should come up and x=y
should show on the URL line, but it does not.
(Note that they *do* submit, they just don't submit using the input type=text
algorithm.)
Blocks: 104449
Neil, any chance you could test IE on the second testcase here and let me know
what it does?
Attached patch Possible patch (obsolete) — Splinter Review
Whether this is good depends on what IE does on that testcase...
Taking
Assignee: form → bz-vacation
OS: Windows XP → All
Priority: -- → P2
Hardware: PC → All
Summary: checkbox and radio do not submit by clicking submit button → [FIX]checkbox and radio do not submit by clicking submit button
Target Milestone: --- → mozilla1.7alpha
FWIW, IE5 behaviour appears to be as follows:
1. If the form has exactly one ordinary input, which has the focus, then submit
*without* clicking the submit button, for Netscape 4.x compatibility.
2. If a submit button exists, then click it.
3. Otherwise, don't submit.
Mozilla 1.4 appears to be as follows:
1. If the focus is not on an ordinary input, then submit.
2. If a submit button exists, then click it.
3. If the form has exactly one ordinary input, then submit.
4. Otherwise, don't submit.
So, the behaviour differs for all checkboxes plus form 6's input.
By "ordinary input" you mean <input type="text">?

So in form 6, hitting enter on the checkbox clicks the button?  And hitting
enter on the text input does not?
Oh, I recall now.  The difference for the text input in form 6 we introduced
purposefully.  See bug 147850

So to recap.  The behavior when hitting enter on the various inputs in IE is as
follows:

Form 2: does not submit
Form 3: submits on textfield, not on checkbox
Form 4: does not submit
Form 5: submits by clicking button
Form 6: submits by clicking button on checkbox, just submits on textfield
Form 7: submits by clicking button

That about sum it up?

With the patch I attached, our behavior is like that with two exceptions:  The
form 6 exception you pointed out, and we submit on the checkbox in form 3.  That
seems a little more consistent to me....
Looks good to me.
Comment on attachment 136159 [details] [diff] [review]
Possible patch

jst, what do you think?
Attachment #136159 - Flags: superreview?(jst)
Attachment #136159 - Flags: review?(jst)
Comment on attachment 136159 [details] [diff] [review]
Possible patch

I don't like the fact that hitting enter causes a click event to be generated,
but given that that's the way the web expects browsers to work, we don't really
have a choice...

r+sr=jst
Attachment #136159 - Flags: superreview?(jst)
Attachment #136159 - Flags: superreview+
Attachment #136159 - Flags: review?(jst)
Attachment #136159 - Flags: review+
Summary: [FIX]checkbox and radio do not submit by clicking submit button → [FIXr]checkbox and radio do not submit by clicking submit button
Attached patch Updated to tipSplinter Review
Attachment #136159 - Attachment is obsolete: true
Checked in for 1.7a.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: