angst
10-22-2005, 07:06 PM
Hello,
I'm trying to use the fallowing script for form valildation, it does give me the alert message when feilds are not completed, but when I click ok, it submits the page anyway,,
any ideas???
thanks in advance for your time!
<script language="JavaScript" type="text/javascript">
<!--
function checkform ( form )
{
if (form.fname.value == "" &&
form.lname.value == "" &&
form.phone.value == "" &&
form.serv.value == "" &&
form.month.value == "-" &&
form.day.value == "-" &&
form.time.value == "-")
{
alert( "Please complete all feilds!" );
form.email.focus();
return false ;
}
//return true ;
}
//-->
</script>
<form action='sendmail.php' method='post' onsubmit="return checkform(this);">
I'm trying to use the fallowing script for form valildation, it does give me the alert message when feilds are not completed, but when I click ok, it submits the page anyway,,
any ideas???
thanks in advance for your time!
<script language="JavaScript" type="text/javascript">
<!--
function checkform ( form )
{
if (form.fname.value == "" &&
form.lname.value == "" &&
form.phone.value == "" &&
form.serv.value == "" &&
form.month.value == "-" &&
form.day.value == "-" &&
form.time.value == "-")
{
alert( "Please complete all feilds!" );
form.email.focus();
return false ;
}
//return true ;
}
//-->
</script>
<form action='sendmail.php' method='post' onsubmit="return checkform(this);">