Page 1 of 1

Why does form continue to submit after return false?

Posted: Wed Aug 04, 2004 11:28 am
by voltrader
Why does the form continue to submit after this returns false?

Code: Select all

<?php
	if(password.value!="")
			{
			
			if(password.value != confirm_password.value)
			{
			alert("Passwords do not match");
			password.focus();
			return false;
			}
?>

Posted: Wed Aug 04, 2004 11:38 am
by hawleyjr
Use this for your submit button:

Code: Select all

<input type="submit" name="Submit" value="Submit" onClick="javascript:myFunction();return false;">

Posted: Wed Aug 04, 2004 11:40 am
by hawleyjr
That wasn't enough info....


and for you javascript use:

Code: Select all

if(password.value != confirm_password.value) 
         &#123; 
         alert("Passwords do not match"); 
         password.focus(); 
         return false; 
         &#125;else&#123;
document.formname.submit();
&#125;

Posted: Wed Aug 04, 2004 12:15 pm
by voltrader
Great, thanks... I'm going to give it a try