Closed Bug 126237 Opened 23 years ago Closed 23 years ago

form should NOT submit when there is more than one text field in the form and the user hits enter in a text field

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: kmcclusk, Assigned: chak)

References

()

Details

Attachments

(2 files)

This bug was taken from http://bugscape.netscape.com/show_bug.cgi?id=12109

If there is more than one text field on a page then hitting enter in a text
field should not trigger a form Submit.

If there are other web pages which rely on the enter key for form submission
from a text field(even when there are multiple text elements on
a page) then they have to either TAB to the submit button or click on the submit
button for form submission. This is what the spec says and is what NS 4.x does.
Keywords: edt0.9.4
Chak's patch from bugscape 12109
Cc:ing rods, kin since they worked on the original bug
Adding url to rod's comprehensive submit test case from bug 99920,
attatchment 51057:

  http://bugzilla.mozilla.org/attachment.cgi?id=51057&action=view
Note that this bug is in direct contrast to bug 22526.

The patch makes it so that you can only submit if there is only one 
textfield *and* a submit button. In 4.x you could submit without a submit button 
defined for the form.

In the bugscape bug, Ken says he can still crash, although it's not as easy then 
without this patch.

What's the proposal for this patch? 094 branch only? My guess is that if it went 
into the trunk there would be lots of complaints.
The current proposal is we fix it just on the 0.9.4 branch.

OK, this is a stopgap, and it should work to fix the underlying problem reported
in Bugscape.  The reason we are submitting when there are multiple textfields is
IE does it that way.

Is there any real reason to deny submission on single-textfield forms without
submit buttons?  That seems like a bad idea.  (I think sites rely on that
behavior.)  To get the real effect you want, you should change the line to:

+ if (inputTxtCnt == 1) {

I recommend we do *not* apply this to the Mozilla tree.
(By "do not apply to Mozilla tree" I meant to the Mozilla trunk.)
If everyone agrees that it's OK to checkin this updated patch only to the 0.9.4
branch can i pls get an r=/sr=/a= ?
Comment on attachment 70126 [details] [diff] [review]
Updated patch to submit  when we have only a single text field - even without a Submit button

r=jkeiser
Attachment #70126 - Flags: review+
Wait, I think the problem is an event observer/listener ordering problem. 
Checking in this fix only makes the problem less noticeable with multiple 
textfields ... it doesn't fix the problem. If my theory is correct, you should 
be able to reproduce this problem with the text case in the bugscape bug, with a 
single textfield and some hidden input values.
By event ordering, I mean that the keypress handler defined on the password 
field should be fired first, before the default text control handling which does 
a submit on return ... I think the default handling is happening before the 
keypress handler is fired so that is why we are getting the double dialogs.
Yes, you will see the double submit problem with one textfield.  My
understanding is that this is intended to get it to work with specific pages
(which means to me that they will have a username field as well)--I haven't
heard any complaints about this on the Mozilla side that I can remember.

I don't think it's an ordering problem, however.  As it stands, whether the
password submit() happens before or after the submit, it's still going to cause
a submit.  And no matter when the keypress frames code fires, it's still going
to cause a submit.

The problem is we don't short-circuit.  Ever.  That's the bigger double-submit
problem (bug 72906).

The underlying problem we are trying to "fix" (read: work around) right here is
bug 76605, which is dependent on 72906.

A *good* real fix to 72906 is non-trivial.  This at least emulates NS4.x
behavior, so there is some justification for it even in a 0.9.4 branch.
Comment on attachment 70126 [details] [diff] [review]
Updated patch to submit  when we have only a single text field - even without a Submit button

Ok, I'll sr=kin this with the understanding that this is a workaround for the
mozilla0.9.4 branch ONLY.

Do we have to worry about this impacting any other customers that may be using
the 0.9.4 branch?
Attachment #70126 - Flags: superreview+
This is 0.9.4 branch only workaround, but we'll have to face the real resolution
before the next Netscape release is shipped. Could somebody nominate the right
bug (using the right magic keyword)?
It's already been nominated and (+)'ed see bug 72906.

Marking it edt0.9.4+ (i.e., approval for 0.9.4 check-in).
When could we get this in?
Keywords: edt0.9.4edt0.9.4+
fix checked in to 0.9.4 branch...
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Keywords: fixed0.9.4
Ran through tests on this, so far so good. Ran through logins/submits on large 
sites, such as www.aol.com, www.hotmail.com, www.msn.com, www.expedia.com, 
www.m-w.com, www.superpages.com (not a complete list). Ran through form submit 
test cases. No new issues discovered so far. 
Verifying build 2002-02-22-03-trunk windows 2000, build 2002-03-01-03-trunk win 98 
Status: RESOLVED → VERIFIED
Component: HTML: Form Submission → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: