Closed
Bug 321737
Opened 20 years ago
Closed 20 years ago
onsubmit doesn't get fired if form submitted using javascript
Categories
(Firefox :: General, defect)
Tracking
()
People
(Reporter: rail, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5
Shown below is the sample html.
If you click on the button labelled "submit" then the onSubmit event gets fired.
However, if you click on the button labelled "click" the onSubmit event doesn't fire.
As per the w3c spec the submit method is supposed to perform the same action as the submit button.
http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/html.html#ID-76767676
I would think this involves firing the associated event handlers as well.
Quite a bit of our code broke because of this and it took a while to figure this one out :).
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<script>
function submitIt()
{
document.test.submit();
}
function callMe()
{
alert("I got called");
}
</script>
</HEAD>
<BODY>
<form name="test" action="http://www.google.com" method="get" onSubmit="callMe();">
<input type="button" onClick="submitIt()" value="click" />
<input name="submitform" type="submit" value="submit" />
</form>
</BODY>
</HTML>
Reproducible: Always
Steps to Reproduce:
Just try out the code in the details in firefox
Actual Results:
The onsubmit event doesn't fire
Expected Results:
The onsubmit event should fire
Comment 1•20 years ago
|
||
*** This bug has been marked as a duplicate of 45190 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•