Don't sumbit form if JS returns false?
On clicking submit i have to run a JS functio to see if all fields are filled in, well if there not i give a message box etc but the form still posts am using,
HTML Code:
<form method="POST" action="verify.php">
<input type="submit" value="Register" name="B1" onclick="checkfields()">
</form>
<script language = "javascript">
function checkfields(){
}
</script>
I need it not to post if any of the fields are empty
Re: Don't sumbit form if JS returns false?
Change it to
HTML Code:
onclick="return checkfields()"
And in your checkfields() function return TRUE to NOT post the form, FALSE to post it.
Re: Don't sumbit form if JS returns false?
Re: Don't sumbit form if JS returns false?
No problems, don't forget to mark your thread as Resolved from the Thread Tools menu :)