I have a problem with a javascript form validation script I'm currently
using. The script below is what I normally use - however I added " }
else{
alert("All ok");
return true; " [I commented it out]
so it would notify the user that they had filled in the form correctly prior
to submission. If I leave it out it works fine, but the client wants it to tell
them the form is OK. What am I doing wrong here? Any ideas?
---------------------------
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;
}
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;
}
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 true;
}
}