Hey guys im new to javascript and having a few problems with a form validation script. Its supposed to stop sending the form if key fields are missing, but it just sends them anyway!
below is the code i use in the header to check for blank fields:
[code]function checkForm(f)
{
if (f.elements[‘Email’].value == “” && f.elements[‘Telephone’].value == “”)
{
alert(“You have not completed the form correctly, please fill out ALL fields”);
return false;
}
else
{
f.submit();
return false;
}
}
and now the code i use to action it:
[code] <form method=”post” action=”contactprocess.php” name=”sform” onSubmit=”return checkForm(this); return false;”>
from what i can see the fields match, it all links up correctly but still it will allow blank forms to be sent ?
your help would be wonderful!
Thanks
DK