Page 1 of 1

failure to fire onSubmit=...

Posted: Sun Oct 17, 2010 1:00 am
by btd
This perplexed me for a day now. I know I am blind and missing something stupid. Help?
Alert box never pops up and the action gets triggered. So onSubmit() never gets triggered. Why????????

Here is the javascript and html:
<html>
<head>
<title>test</title>
<script type="text/javascript">
function submTest()
{
alert( "submit2" );
return( FALSE );
}
</script>
</head>
<body>
<form name="firstform" action="owner_report.php?lm_xcar=1" method="post">
<input type="submit" id="submitId" name="submitN" value="Summary" onSubmit="return submTest();">
</form>
</body>
</html>

Re: failure to fire onSubmit=...

Posted: Sun Oct 17, 2010 12:05 pm
by btd
The correction and solution:
Do not attach onSubmit to the input.
It belongs with a "FORM":
<form name="firstform" action="owner_report.php?lm_xcar=1" method="post" onSubmit="return submTest();" >