Closed
Bug 304002
Opened 19 years ago
Closed 19 years ago
<button></button> automatically submits my form when using javascript
Categories
(Toolkit :: View Source, defect)
Tracking
()
People
(Reporter: rupertje2, Unassigned)
Details
Attachments
(2 files, 1 obsolete file)
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322) Build Identifier: Mozilla/5.0 When i use the button <button onclick="do_something()"> Testbutton </button> instead of <input type="button" value="testbutton" onclick="do_something()"> Firefox automatically submits my form. When i use the second button everything goes well. It's a javascript problem Reproducible: Always Steps to Reproduce: <html> <head> <title> Javascripttest </title> </head> <script language="javascript"> <!-- function check2() { return false; } function check() { alert ("check"); if (check2()) { document.test.submit(); } else { alert ("Don't do a submit!"); } } function test_onload() { alert ("form onload"); } --> </script> <body onload="test_onload()"> <form name="test" action="index.htm" method="POST"> <button name="btn_test2" onclick="check()">test button button</button> <input type="button" name="btn_test" onclick="check()" value="test button input"> </form> </body> </html> Actual Results: Still wrong Expected Results: Not doing a submit when pressing <button></button>!
The other attachment is a misstake. This is the good attachment. Sorry example code what's going wrong
Attachment #192073 -
Attachment is obsolete: true
Comment on attachment 192075 [details]
example code what's going wrong
The code here runs well
I don't now exactly why, but probaly because it runs in another form
Comment on attachment 192074 [details]
example code what's going wrong
Sorry wrong attachment
This is a duplicate of bug 97829. The default type for BUTTON is "submit" (IE gets this wrong) and your onclick event handler doesn't return false, so the form is submitted.
Comment 7•19 years ago
|
||
*** This bug has been marked as a duplicate of 97829 ***
Severity: blocker → normal
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
Assignee | ||
Updated•16 years ago
|
Product: Firefox → Toolkit
You need to log in
before you can comment on or make changes to this bug.
Description
•