Hi there,
I'm working on someone else's site, and I need to add something to their form to make sure that the email address people enter is the correct format (i.e. it has a @ sign and a "."). It currently only checks if there is anything in the field at all.
This is the javascript validation that they're currently using:
<script language = "javascript">
function verifyEnEnquiry(theform) {
var my_message = "default";
if(document.enquiries.FullName.value == "") {
alert("'.$sb->dt('Sorry, but you cannot proceed unless you complete your Full Name').'");
//return false;
} else
if(document.enquiries.Company.value == "") {
alert("'.$sb->dt('Sorry, but you cannot proceed unless you complete your Company Name').'");
//return false;
} else
if(document.enquiries.Email.value == "") {
alert("'.$sb->dt('Sorry, but you cannot proceed unless you complete your Email ').'");
//return false;
} else
if(document.enquiries.address_4.value == "") {
alert("'.$sb->dt('Sorry, but you cannot proceed unless you complete your City').'");
//return false;
} else
if(document.enquiries.Enquiry.value == "") {
alert("'.$sb->dt('Sorry, but you cannot proceed unless you complete your Enquiry ').'");
//return false;
} else
if(document.enquiries.JobTitle.value == "") {
alert("'.$sb->dt('Sorry, but you cannot proceed unless you complete your Job Title').'");
//return false;
} else
if(document.enquiries.country.selectedIndex == 0)
{
alert("'.$sb->dt('Sorry, but you cannot proceed unless you complete your Country').'");
//return false;
} else
if(document.enquiries.address_1.value == "") {
alert("'.$sb->dt('Sorry, but you cannot proceed unless you complete your Address').'");
//return false;
} else
if(document.enquiries.Postcode.value == "") {
alert("'.$sb->dt('Sorry, but you cannot proceed unless you complete your Postcode').'");
//return false;
}
else {
//return true;
document.enquiries.submit();
}
//alert(my_message);
}
</script>
What do I need to add to that to get it to check the @ and "." too?