Closed
Bug 457818
Opened 16 years ago
Closed 16 years ago
button inside form submits
Categories
(Firefox :: General, defect)
Tracking
()
People
(Reporter: magnus.isaksson, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; sv-SE; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; sv-SE; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3 <button onClick="someJavaScript()">, the function someJavaScript has no submit(). Why does mozilla but not IE submit form? Pretty sure this does not happend in previous mozilla versions. Using button instead of input type submit inorder to control submit. I've checked for updates on mozilla but none to find. Checked bug reports but nothing seems to match. Tried to figure out what standard says but no wiser. Reproducible: Always Steps to Reproduce: <?php if(isset($_POST['Kalle'])) { echo 'Not submitted....? Kalle value: ' . $_POST['Kalle']; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Testar button</title> <script type="text/JavaScript" src="JavaScripts/java_scripts.js"></script> <script type="text/javascript"> function someJavaScript(param1) { var tmp = document.getElementById('stat'); tmp.name = 'Kalle'; tmp.value = param1; } </script> </head> <body> <form name="test_form" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <input type="hidden" name="stat" id="stat"> <button onClick="someJavaScript(4)">Click Me</button> </form> </body> </html> Actual Results: Well, try the code above in both mozilla and IE 6 and 7. Only mozilla submits by itself. Not submit since there's no submit statement.
Comment 1•16 years ago
|
||
The default button type is "submit" which means clicking it will submit the form it is in (unless your click handler cancels that). http://www.w3.org/TR/html4/interact/forms.html#h-17.5 It is a bug in IE that buttons do not do this by default.
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•