Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
192
rated 0 times [  194] [ 2]  / answers: 1 / hits: 21511  / 14 Years ago, tue, march 1, 2011, 12:00:00

When a User Submits the form i want to stop the default behavior of the form. ie it should not reload. so that i can perform the AJAX request.



here is the code i used.



<script type=text/javascript>
function validateForm()
{
return false;
}
</script>
<form action= name=contact onsubmit=validateForm();>
<input type=text name=name value=Enter Your Name.../>
<input type=submit name=submit/>
</form>


this does not stop the form from being submitted or reloaded. how do i achieve this?


More From » javascript

 Answers
8

It needs to be onsubmit=return validateForm()


[#93524] Sunday, February 27, 2011, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brianaclaras

Total Points: 23
Total Questions: 106
Total Answers: 111

Location: Japan
Member since Sat, Jun 6, 2020
4 Years ago
;