Name and value of submit item not being sent as part of content data.




HTML: Form Submission
16 years ago
16 years ago


(Reporter: Richard Heurtley, Assigned: John Keiser (jkeiser))


Windows NT

Firefox Tracking Flags

(Not tracked)




(1 attachment)



16 years ago
The URL provided is a form with some simple JavaScript generated by a CGI program. 

The purpose of the JavaScript is to submit the form as if the "goto" button was
clicked when the [Enter] key is pressed while entering data into the "where" field.

It works with IE5.5 and Netscape 4.79 but does not work with Mozilla 1.0.

With IE5.5 and Netscape 4.79 the content data sent to the CGI program looks like
this (with "500" entered into the "where" field:


With Mozilla 1.0 the content data looks like this:


The "goto=%A0%A0..." term isn't there.

I added some debugging code to the JavaScript and verified that the call is occuring. I also tried calling element.focus() prior to to no avail. I looked at the Mozilla Javascript porting guide
and I don't think I'm trying to use unstandard and unsupported functionality.

Comment 1

16 years ago
Browser, not engine ---> Form Submission
Assignee: rogerl → alexsavulov
Component: JavaScript Engine → Form Submission
QA Contact: pschwartau → vladimire

Comment 2

16 years ago
Assignee: alexsavulov → jkeiser

Comment 3

16 years ago
Need instructions to reproduce.  There are a lot of buttons on that page.  The
problem is most likely that you are doing form.submit(); inside an onClick
handler of a submit button.  form.submit() in *all* browsers does not send the
name/value of the submit button.  That happens after the onClick handler has
finished--the form is submitted a second time (form.submit() was the first),
this time with the goto name/value.  This is the one you will eventually see.

Mozilla protects you from submitting twice and does not send the second submit.
 This is the source of the problem.

You can fix the problem by just not calling form.submit() in the onclick handler.

Comment 4

16 years ago
The JavaScript doesn't call form.submit() and doesn't have an onClick() 
handler. It calls inside an onKeyPress() handler.

Sorry about the long form. The only relevent button is the one named 
"goto". On the form it's to the left of the "Goto record" label.

To reproduce, bring up the form, enter a number in the "Goto record" field, 
and press [Enter]. The submitted data doesn't have a "goto=..." item. Under 
Internet Explorer and Netscape 4.7 there is a "goto=..." item.

I don't think that in this case IE and NS 4.7 are submitting the form 
twice. My CGI application throws a security alert when it gets a request 
without a submit name/value. I only see these alerts with Mozilla.

Comment 5

16 years ago
I've got the same problem after upgrading to 1.0 (0.9.7 and 0.9.8. worked fine).
Here is the "problem" code (this.submit() is called but the name and value of
submit are not passed along):

<form action="/cgi-bin/con/usched" method="post" onSubmit='if
(chkinp(this,"Add")) {this.submit()} else{return false;}'>
<input type="hidden" name="subdep" value="70">
<select name="user" size=10>
<option value="621">Someone
<select name="act" size=10>
<option value="1">Something
<input type="submit" name="Insert" value="Add">
<input type="submit" name="InsertS" value="As of Today"></form>

Comment 6

16 years ago
Created attachment 91109 [details]
Richard's Testcase

This is Richard's testcase.  It seems to work.	I clicked on #21 and it
submitted the submit button value (row20=?????) and I clicked on the first
submit button and it submitted main=?????.  All seems well.

Comment 7

16 years ago
Richard: which button do I have to press on that?  I changed the action on your
form to a host that is reachable on the Internet (that happens to print out post
values) and uploaded.  There seem to be no problems.

Tevel: your problem is different from his, if he has one--his doesn't seem to
have form.submit() in it.  Your problem can be solved by replacing
"form.submit()" with return true;.  It results from our double submit
protection.  form.submit() *always* submits without name and value, but the
submit handler for the button (what happens when you return true from the
onSubmit event) submits the name/value of the button.

Comment 8

16 years ago

Comment 9

16 years ago
I uploaded a much shorter test form to 
http:\\\richard\short.html .

You'll still need to edit it to submit to a CGI program that'll show the 

Enter a number (like 555) into the text field.
If you click on the button the content is "goto=%A0%A0%A0%A0%A0;where=555"
If you press [Enter] the content is "where=555".

The (probably very bad) JavaScript calls the function to 
simulate a button click when [Enter] is pressed.

Comment 10

16 years ago
This is what I get from the short testcase on win98 build 2002-07-10-08-trunk:
Can you retest with a recent nightly build?
Last Resolved: 16 years ago
Resolution: --- → WORKSFORME

Comment 11

16 years ago
Yep. I just now downloaded 1.1a and it works fine. I should have tried it 
when it first came out. Sorry about that.

Hurray! Now I can dump IE and have my office standardize on Mozilla! What a 

Thanks for all your good work!

Comment 12

16 years ago
cool. verifying.
You need to log in before you can comment on or make changes to this bug.