onSubmit returning false is not working
- by StuckOnSubmit
I'm completely confused ... I'd swear this was working yesterday ... I woke up this morning and all my forms stopped to work in my project.
All the forms have a "onsubmit" to a function that returns false since it's an ajax call, so the form is never sent.
After a lot of tests, I simplified the question to this piece of code:
<html>
<head>
<script type="text/javascript">
function sub()
{
alert ("MIC!");
return false;
}
</script>
</head>
<body>
<form method = "post" id = "form1" onsubmit = "return sub()">
input: <input type="text" name="input1" >
<a href="#" onClick="document.getElementById('form1').submit();">button</a>
</form>
</body>
</html>
I would swear that this works perfectly, but today is nor working :D
Why if I press the button the form is sent ?
I know it's a total newbie question, but I'm stuck
Thank you !