//Validate the online application form function validateForm(objForm) { if (objForm.Applicant_Name.value == "") { alert("Please enter your name."); objForm.Applicant_Name.focus(); return false; } if (objForm.Applicant_Phone.value == "") { alert("Please enter your contact telephone number."); objForm.Applicant_Phone.focus(); return false; } else if (!checkPhoneNumberValid(objForm.Applicant_Phone.value)) { alert("Please enter a valid contact telephone number (e.g. no letters, brackets or spaces)."); objForm.Applicant_Phone.focus(); return false; } if (objForm.Applicant_Area_Code.value == "") { alert("Please enter your telephone area code."); objForm.Applicant_Area_Code.focus(); return false; } else if (!checkPhoneNumberValid(objForm.Applicant_Area_Code.value)) { alert("Please enter a valid telephone area code (e.g. no letters, brackets or spaces)."); objForm.Applicant_Area_Code.focus(); return false; } if (objForm.Applicant_Email.value != "") { if (!checkEmailValid(objForm.Applicant_Email.value)) { alert("Please enter a valid email address."); objForm.Applicant_Email.focus(); return false; } } return true; } function checkPhoneNumberValid(number) { re = /^\(?\d*\)?\s?\d*\s?\d*$/ // Check that the value contains only numbers, one or more times if (!re.test(number)) { return false; } return true; } //check for a valid email address function checkEmailValid(strEmail) { re = /^[a-zA-Z0-9_']+([\.-]?[a-zA-Z0-9_']+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/ if (!re.test(strEmail)) { return false; } return true; }