If validateForm(...) and validateForm1() return a boolean (true means that no validation error occurred), then you try to do that :
function returnTrue() { if(validateForm1() && validateForm2 && validateForm3()) { document.form1.submit(); return true; } else { document.getElementById('validation').innerHTML = 'Validation failed!'; return false; } }
<form action="" method="post" name="form1" enctype="multipart/form-data" onSubmit="return returnTrue()">
First name:
<input type="text" name="FirstName" value="Mickey"><br>
Last name:
<input type="text" name="LastName" value="Mouse"><br>
<input type="text" name="Submit" value="Submit">
</form>
First name:
<input type="text" name="FirstName" value="Mickey"><br>
Last name:
<input type="text" name="LastName" value="Mouse"><br>
<input type="text" name="Submit" value="Submit">
</form>
No comments:
Post a Comment