Closed Bug 109463 Opened 18 years ago Closed 18 years ago

Submitting a form by pressing enter drops fields[form sub]

Categories

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

defect
Not set
major

Tracking

()

VERIFIED FIXED
mozilla0.9.8

People

(Reporter: mobydisk, Assigned: bzbarsky)

References

()

Details

(Keywords: top100)

Attachments

(2 files, 1 obsolete file)

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.4) Gecko/20010913
BuildID:    2001091303

If you execute a search using this e*Bay form, clicking the "Search" button is
successful.  If you press Enter then Mozilla submits the fields from the
previous form submission, or blank if this is the first time.

Reproducible: Always
Steps to Reproduce:
1.Go to http://pages.ebay.com/search/items/search.html
2.Enter something into the search title.  Ex. "ski pants"
3.Press Enter

Actual Results:  A blank form is submitted.  eBay will return to you the generic
page for an empty search.

Expected Results:  Mozilla should have posted the specified form parameters.

1) This form works in IE5.
2) If you press the "Search" button it works.
3) Additional test:
  1.Initiate a search by clicking the "search" button as above.
  2.Notice that e*Bay tells you what your search string was.  Click back.
  3.Modify the search and hit Enter (don't press "search")
  4.Notice that e*Bay still indicates the same search as before.
confirmed
Severity: normal → major
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: top100
Summary: Submitting a form by pressing enter drops fields → Submitting a form by pressing enter drops fields[form sub]
This test case is the reduced version of what is to see on search.ebay.com.
The problem is that the submit button has a onClick attribute that calls a
needed javascript function. The ENTER key does not trigger onClick.

IE triggers onClick for the submit button also when ENTER is pressed in one of
the form's fields.

--> event handling
to event handling
Assignee: alexsavulov → joki
Component: Form Submission → Event Handling
QA Contact: vladimire → madhur
with the testcase provided --
1. I see the bug when I enter some search text in query 2, hit enter from the 
textbox field.

2. After entering search text in query 2, if i tab to the submit button or click 
on it, the search string is submitted sucessfully.

with the url provided http://pages.ebay.com/search/items/search.html
1. i enter search string in the 1st search box on the top right of the page and 
hit enter without tabbing to the submit button - the search string is submitted 
successfully.

2. i enter search string in the 'Search title' text box and hit enter - i see 
the bug
Target Milestone: --- → mozilla0.9.8
*** Bug 114383 has been marked as a duplicate of this bug. ***
*** Bug 115780 has been marked as a duplicate of this bug. ***
John, does this sound related to your form submission changes?
As per bug 115780 and Alex's comments, this is caused by the onClick() of the
submit button for the form not being run if you hit return in the form.  IE runs
this JS.  It makes sense, since hitting return is the equivalent of hitting the
submit button.

Fix that, and this bug is solved.  Please....

OS All, platform all, adding Brendan and rods.  Is this really "event handling",
BTW?  I'd think it was forms or maybe some part of JS.
OS: Windows 98 → All
Hardware: PC → All
was John's change in the form submission already included in that version?

see the first comment:

User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.4) Gecko/20010913

rjesup: there's no JS involvement, the core engine does not know or care about
things like enter-in-textfield and submit onclick.  I agree this is more of a
form bug than an event one, though -- jst, anyone: shouldn't this go to someone
other than joki?

/be
Component: Event Handling → HTML Form Controls
Yes.  HTML Form Controls.  The problem is almost certainly that we are not
calling the right function or set of functions when ENTER is pressed.

My changes landed on 10/31, though and if that build ID is right we've been
doing this since 0.9.4. (!)  Strange, I didn't think the press-ENTER-to-submit
patch went in 'til 0.9.5, but I could easily be wrong.
So if it's form controls, I guess it should be reassigned to the owner of that
(rods?)  Reassigning to default owner/QA for form controls since the component
was already changed.
Assignee: joki → rods
->>
Assignee: rods → alexsavulov
Attachment #57704 - Attachment is obsolete: true
The behavior of IE5 and IE6 (as tested on that testcase) is as follows:

1)  If the form contains only one text (password) input, simply submit the form on
    enter in that text (password) input.  Submit buttons (if any) are _not_ sent
    in the form data that is sent to the server.

2)  If the form contains 2 or more text (password) inputs, trigger the submit
    button.  This means that the submit button's onclick event is fired (before
    the form's onsubmit) and the submit button value is sent to the server.
Attached patch Proposed patchSplinter Review
Passes the testcases in this bug, as well as the testcase in bug 99210 (so no
regressions).

Rod, would you review?
Comment on attachment 64976 [details] [diff] [review]
Proposed patch

r=rjesup@wgate.com (for whatever it's worth; I've hacked on forms some for
<select>)
Attachment #64976 - Flags: review+
Comment on attachment 64976 [details] [diff] [review]
Proposed patch

I concur with that assessment if it's worth any more :)  r=jkeiser
Comment on attachment 64976 [details] [diff] [review]
Proposed patch

sr=jst
Attachment #64976 - Flags: superreview+
ressigning
Assignee: alexsavulov → bzbarsky
I haven't applied the patch and tested it, but it looks right. r=rods
checked in.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
verifying on build 2002-01-28-03-trunk on windows 98
and on 2002-01-28-08-trunk on RedHat Linux 6.2
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.