Closed
Bug 187042
Opened 22 years ago
Closed 22 years ago
Return/enter to submit form sends name/value pair of first input/button
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
VERIFIED
DUPLICATE
of bug 156683
People
(Reporter: weeber51, Assigned: alexsavulov)
Details
Attachments
(1 file)
178 bytes,
text/html
|
Details |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3b) Gecko/20021226 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3b) Gecko/20021226 Using a particular button to submit a form (by clicking or keyboard or whatever) should submit that button's name/value pair. This functionality is present because (according to http://www.htmlhelp.com/reference/html40/forms/input.html): The submit input type defines a button for submitting the form. As with reset, the optional VALUE attribute provides the text of the button. The presence of the NAME attribute will cause the browser to send a name/value pair for the submit button if it is used to submit the form. This allows authors to provide multiple submit buttons and have the form handler take a different action depending on the submit button used. I looked at the W3C, but actually couldn't find this. But that behavior makes enough sense, so I think it's right. But when a form is submitted by pressing enter or return, I don't think (again, I couldn't confirm this with the W3C's site) that any input's or button's name/value pairs should be included since none were used to submit the form. A case in point is Google (see steps to reproduce). IE does not submit name/value pairs when the form is submitted with enter or return. Reproducible: Always Steps to Reproduce: 1.Go to www.google.com 2.Type any query 3.Submit with enter or return 4.Might want to repeat 1-3 in IE for comparison Actual Results: btnG=Google+Search is sent to Google, suggesting that the button was used for submission. Consequently, Google also shows the tip: "In most browsers you can just hit the return key instead of clicking on the search button." Expected Results: btnG=Google+Search should not be sent and the tip should not appear.
This test case just shows what Mozilla submits by GET method. I'm sure the form's action points to a non-existent file, so submission probably will put you at an error page, but I think the location bar will still show the query. Anyway, notice that when submitting this form with enter/return, submit=input is included. This also shows something that I forgot to mention: only the first input or button element's name/value pair is submitted.
Comment 2•22 years ago
|
||
This is done quite on purpose, for consistency with the "multiple text field" case in which IE _does_ send the first button (as does Mozilla, of course). There is no reason to introduce this gratuitous inconsistency based on merely the number of text/password inputs in the form.... *** This bug has been marked as a duplicate of 156683 ***
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
Updated•5 years ago
|
Component: HTML: Form Submission → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•