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

RESOLVED FIXED in mozilla1.7alpha

Status

()

P2
normal
RESOLVED FIXED
16 years ago
15 years ago

People

(Reporter: john, Assigned: bzbarsky)

Tracking

(Blocks: 1 bug)

Trunk
mozilla1.7alpha
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments, 1 obsolete attachment)

(Reporter)

Description

16 years ago
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.
(Reporter)

Comment 1

16 years ago
Created attachment 112570 [details]
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.
(Reporter)

Comment 2

16 years ago
(Note that they *do* submit, they just don't submit using the input type=text
algorithm.)
(Reporter)

Updated

16 years ago
Blocks: 104449
(Assignee)

Comment 3

15 years ago
Created attachment 136157 [details]
More extensive testcase
(Assignee)

Comment 4

15 years ago
Neil, any chance you could test IE on the second testcase here and let me know
what it does?
(Assignee)

Comment 5

15 years ago
Created attachment 136159 [details] [diff] [review]
Possible patch

Whether this is good depends on what IE does on that testcase...
(Assignee)

Comment 6

15 years ago
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

Comment 7

15 years ago
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.
(Assignee)

Comment 8

15 years ago
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?
(Assignee)

Comment 9

15 years ago
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....

Comment 10

15 years ago
Looks good to me.
(Assignee)

Comment 11

15 years ago
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+
(Assignee)

Updated

15 years ago
Summary: [FIX]checkbox and radio do not submit by clicking submit button → [FIXr]checkbox and radio do not submit by clicking submit button
(Assignee)

Comment 13

15 years ago
Created attachment 138447 [details] [diff] [review]
Updated to tip
Attachment #136159 - Attachment is obsolete: true
(Assignee)

Comment 14

15 years ago
Checked in for 1.7a.
Status: NEW → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.