Hello,
I am using the script below to check my form for errors. It works if I take out the "else alert("All ok"
; return false;"[/red] part. But, I really need it in there, where am I going wrong with this?
All I want it to do is check the form then tell me its OK if the fields are filled in...correctly.
-----------------
function contactCheck()
{
if (document.contactform.first_name.value == ""
{
alert("First Name | Problem:\n\nYou forgot to enter\nyour first name\n\nPlease enter it\n\nThis entry is required!."
;
document.contactform.first_name.focus();
return false;
}
else if (document.contactform.last_name.value == ""
{
alert("Last Name | Problem:\n\nYou forgot to enter\nyour last name\n\nPlease enter it\n\nThis entry is required!."
;
document.contactform.last_name.focus();
return false;
}
else if (document.contactform.submit_by.value.indexOf("@"
== -1 ||
document.contactform.submit_by.value == ""
{
alert("Email Address | Problem:\n\nYou forgot to enter\nyour email\n\nPlease enter it\n\nThis entry is required!."
;
document.contactform.submit_by.focus();
return false;
else alert("All ok"
;
return false;
}
} • idaryl • •
I am using the script below to check my form for errors. It works if I take out the "else alert("All ok"
All I want it to do is check the form then tell me its OK if the fields are filled in...correctly.
-----------------
function contactCheck()
{
if (document.contactform.first_name.value == ""
{
alert("First Name | Problem:\n\nYou forgot to enter\nyour first name\n\nPlease enter it\n\nThis entry is required!."
document.contactform.first_name.focus();
return false;
}
else if (document.contactform.last_name.value == ""
{
alert("Last Name | Problem:\n\nYou forgot to enter\nyour last name\n\nPlease enter it\n\nThis entry is required!."
document.contactform.last_name.focus();
return false;
}
else if (document.contactform.submit_by.value.indexOf("@"
document.contactform.submit_by.value == ""
{
alert("Email Address | Problem:\n\nYou forgot to enter\nyour email\n\nPlease enter it\n\nThis entry is required!."
document.contactform.submit_by.focus();
return false;
else alert("All ok"
return false;
}
} • idaryl • •
