I'm calling a simple e-mail validator in JavaScript as the below shows - this works fine as I'm calling it in my HTMl form as such:
<form name="email" action="mail.php" onsubmit="return SubMail_Validator(this)" method="POST">
Then this code does the validation that an e-mail has been entered - however - I need the validator to then run the window.location.href to route users to another page - and this doesn't happen - it stays on the mail.php page. So ideally - I'm e-mailing the user with the action - and then the onsubmit validates - but then I want users routed to another page:
<script language="JavaScript">
<!--
function SubMail_Validator(email)
{
if (email.from.value == "")
{
alert("Please enter a value for the E-mail field.");
email.from.focus();
return (false);
}
if (email.from.value.indexOf('@',0 ) == -1)
{
alert("Invalid E-mail Address");
email.from.focus();
return(false);
}
return (true);
window.location.href = 'my_test_web_site_location';
}
//-->
</script>