Closed Bug 274309 Opened 20 years ago Closed 20 years ago

[FIXr]default submit button sends no real value to cgi script, even if name="xxx" is specified in the form field

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla1.8beta1

People

(Reporter: e_mayilme, Assigned: bzbarsky)

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7) Gecko/20040623 Camino/0.8 Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7) Gecko/20040623 Camino/0.8 Consider the following from an HTML page: <input name="submit" type="submit" /> The CGI script evaluates the presence of this field by saying if (param('submit')) { # foo ... } When other browsers submit the form by a click on the form field, the code called foo will be executed. In Mozilla/Firefox/Camino, the behavior is the same as if the HTML for the form field contained only <input type="submit" /> Even though the form field's default value of "Submit Query" is invented by the browser, and its specific content may vary from one browser to another, it is not an error for the CGI script to check for the presence of param('submit') as a truth value. Therefore, Mozilla ought to send something as the value of the field. It is true that 'Submit Query' is nothing that the HTML author wrote, and so it seems wrong to send it as the value of the field. However, it is better to do this than to send "submit=" to the CGI script, and thus give a false truth value. Reproducible: Always Steps to Reproduce: 1. 2. 3.
As far as I remeber, this is DUP of other old bug, though I could not find the bug. Reporter, what will happen when value="submit" is specified on <SUBMIT>? HTML 4.01 specification says ; ( http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#h-17.13.2 ) > 17.13.2 Successful controls > A successful control is "valid" for submission. Every successful control has > its control name paired with its current value as part of the submitted form > data set. A successful control must be defined within a FORM element and must > have a control name. > > However: > * Controls that are disabled cannot be successful. > * If a form contains more than one submit button, only the activated submit > button is successful. > * All "on" checkboxes may be successful. > * For radio buttons that share the same value of the name attribute, only the > "on" radio button may be successful. > * For menus, the control name is provided by a SELECT element and values are > provided by OPTION elements. Only selected options may be successful. > When no options are selected, the control is not successful and neither > the name nor any values are submitted to the server when the form is > submitted. > * The current value of a file select is a list of one or more file names. > Upon submission of the form, the contents of each file are submitted with > the rest of the form data. The file contents are packaged according to the > form's content type. > * The current value of an object control is determined by the object's > implementation. > > If a control doesn't have a current value when the form is submitted, > user agents are not required to treat it as a successful control. Key descriptions are ; (a) A successful control is "valid" for submission. (b) Every successful control has its control name paired with its current value as part of the submitted form data set. (c) If a control doesn't have a current value when the form is submitted, user agents are not required to treat it as a successful control. If you want to keep this bug open, severity have to be Enhancement for compatibilitiy with IE.
So.. we do send the "submit" control, with a value of "" (which is what the value is). So a reasonably-written CGI can tell this apart from the value not being sent at all. I just tested Opera and Konqueror, and they send "Submit" as the value. So do we want to send a nonempty value in this case?
On first thought, my opinion is that if Navigator 4.x and prior versions of Mozilla do not send a default value for a value-less submit, then the vast majority of html/cgi out there would already take this into account and there would be few sites which would benefit. Compatibility wise: MSIE6 sends Submit+Query while Opera 7.54/8.00 sends Submit. With that said, I see no apriori reason to not do this if it enhances compatibility. Considering W3C's attitude towards HTML and browsers in general, I don't see a need to be a slave to them.
NS4 sent submit=Submit+Query, like IE.
Assignee: general → form-submission
Status: UNCONFIRMED → NEW
Component: General → HTML: Form Submission
Ever confirmed: true
Product: Mozilla Application Suite → Core
QA Contact: general → ian
Version: unspecified → Trunk
Attached patch PatchSplinter Review
I found someone on IRC to test a localized Chinese version of IE, and in that case IE sends a Chinese string for the value. So sending the localized string is the "right" thing to do for compat.
Assignee: form-submission → bzbarsky
Status: NEW → ASSIGNED
Attachment #171471 - Flags: superreview?(jst)
Attachment #171471 - Flags: review?(jst)
Priority: -- → P2
Summary: default submit button sends no real value to cgi script, even if name="xxx" is specified in the form field → [FIX]default submit button sends no real value to cgi script, even if name="xxx" is specified in the form field
Target Milestone: --- → mozilla1.8beta
Comment on attachment 171471 [details] [diff] [review] Patch r+sr=jst
Attachment #171471 - Flags: superreview?(jst)
Attachment #171471 - Flags: superreview+
Attachment #171471 - Flags: review?(jst)
Attachment #171471 - Flags: review+
Summary: [FIX]default submit button sends no real value to cgi script, even if name="xxx" is specified in the form field → [FIXr]default submit button sends no real value to cgi script, even if name="xxx" is specified in the form field
Fixed.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
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: