Closed
Bug 143440
Opened 22 years ago
Closed 22 years ago
Submit buttons do not submit their values when submit() is called
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
VERIFIED
INVALID
People
(Reporter: harunaga, Assigned: john)
References
()
Details
<input type="image"> submited by JavaScript doesn't send coordinates (x,y) on Mozilla 1.0 RC1 and later. document.mainForm.submit(); document.forms[0].submit(); document.getElementById("mainForm").submit(); fail all on 2002050603/Mac OS 9.2 and others. On 0.9.9/Mac, these work. This is similar to Bug 122238, but this is a problem of JavaScript/DOM. If not using JavaScript, there is no problem. And when displaying document.forms['mainForm'].elements[II].name/type, Mac IE 5.1.4 shows like blow: ----- document.forms['mainForm'].elements.length=5 document.getElementsByTagName('input').length=5 II=0,NAME=c1,TYPE=image II=1,NAME=c2,TYPE=image II=2,NAME=c3,TYPE=image II=3,NAME=c4,TYPE=image II=4,NAME=xxx1,TYPE=button ----- but Mozilla shows: ----- document.forms['mainForm'].elements.length=1 document.getElementsByTagName('input').length=5 II=0,NAME=xxx1,TYPE=button ----- Is it OK?
Comment 1•22 years ago
|
||
IE/Windows does not have <input type="image"> in form.elements, so neither do we, otherwise a number of pages breaks. To jkeiser, but there's something I don't understand here... The form is _not_ submitted via the image input. It's submitted via the submit() method on the form. So I really fail to see a reason to send the coordinates (the submit() method simply has no coordinates associated with it). If it "worked" before, I feel that was a bug.
Assignee: rogerl → jkeiser
Component: JavaScript Engine → Form Submission
Assignee | ||
Updated•22 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
Assignee | ||
Comment 2•22 years ago
|
||
Um, anytime you call submit() with JS it will *not* send x and y. input type=image is a submit button. You will notice that input type=submit does not send its value unless you click it (JS will not send it). Same with input type=image. The issue you are seeing is trickier but still invalid. You do not need to call submit() from within the JS handler for an image input. input type=image is a submit button and as such will submit on its own. The reason this worked before was that we were not catching double submit. The JS was submitting *and* the input type=image was submitting, which could cause people big problems. Now we take the first submit only, which in this case is the JS. Mac IE puts the images into the array??? That is good to know, but many pages are written assuming input type=image is not in the array. Perhaps at some point we can put them in quirks mode. File a bug if this is something you want. But realize that if you write a page assuming input type=image is in the array Windows IE will not work with it.
Reporter | ||
Comment 4•22 years ago
|
||
Yes, Windows IE 6.0 doesn't put the images into the array too, but *send* x/y by submit(). Please try the URL above on Windows IE, and click image area, and watch the URL bar changing from http://www.t3.rim.or.jp/~harunaga/test/form-submit.html to http://www.t3.rim.or.jp/~harunaga/test/form-submit.html?c1.x=27&c1.y=6 etc.
QA Contact: vladimire → pschwartau
Assignee | ||
Comment 5•22 years ago
|
||
OK, there is an ambiguity in the spec which could indicate, by a certain reading, that submit() should submit the value of the currently-being-clicked control. This can be tested in IE with the code: <html><body><form name=mainform><input type=submit name=a value=foo onClick="document.mainform.submit(); return false;"></form></body></html> If you would be so kind as to test on IE (I am in Linux right now) that would be great, thanks. If it submits with a=foo then IE works this way. If so, I think this bug is valid and would create the behavior you are looking for.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Summary: <input type=image> submited by JavaScript doesn't send x/y → Submit buttons do not submit their values when submit() is called
Reporter | ||
Comment 7•22 years ago
|
||
I tested the code above on IE 6.0/Win98SE. <input type=submit name=a value=foo onClick="document.mainform.submit(); return false;"> doesn't work. <input type=submit name=a value=foo onClick="document.mainform.submit();"> work. And <input type="image" onClick="document.mainForm.submit()" ...> work, but <input type="image" onClick="document.mainForm.submit();return false;" ...> doesn't work too. I think this bug is invalid. Thank you.
Comment 8•22 years ago
|
||
Tested on IE5/Solaris as well, and adding the "return false" keeps the input element's name from being submitted. Marking invalid.
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago → 22 years ago
Resolution: --- → INVALID
Comment 10•22 years ago
|
||
*** Bug 163742 has been marked as a duplicate of this bug. ***
Reporter | ||
Comment 11•22 years ago
|
||
Chuck, I think this is invalid. But recently, it seems that an enhancement in this case was assigned. See Bug 138957.
Comment 12•6 years ago
|
||
Invalid bug
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
•