Hi there,
I'm not a pro with javascript as I'm sure you'll notice. But I need to get this form to work to validate both the fields here as well as as the e-mail addresses. I wonder can someone tell me what I'm doing wrong please?
<script type="text/javascript">
function validateForm(RegForm) {
var firstName = RegForm.Name.value;
var userName = RegForm.Email.value;
var password = RegForm.Pass.value;
if (firstName.length === 0) {
alert("Please enter a first name.");
return false;
}
if (userName.length === 0) {
alert("Please enter a username (Valid Email).");
return false;
}
if (password.length === 0) {
alert("Please enter a password.");
return false;
}
return true;
}
{
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(RegForm.Email.value)){
return (true)
}
alert("Invalid E-mail Address! Please re-enter.")
return (false)
}
</script>
Thanks for any help you can give.