var validations = new Array(); validations[0] = new Validation("reg_user_Title", "", "MultiSelect", "N", "", "", "", "", "") validations[1] = new Validation("reg_user_FirstName", "", "Alpha", "Y", 50, "", "", "", "") validations[2] = new Validation("reg_user_LastName", "", "Alpha", "Y", 25, "", "", "", "") validations[3] = new Validation("reg_user_Address1", "", "", "Y", 40, "", "", "", "") validations[4] = new Validation("reg_user_Address2", "", "", "", 40, "", "", "", "") validations[5] = new Validation("reg_user_EmailAddress", "", "Email", "Y", 70, "", "", "", "") validations[6] = new Validation("reg_user_ConfirmEmail", "", "", "", "", "", "", "", "ValidateConfirmEmail") validations[7] = new Validation("reg_user_City", "", "", "Y", 40, "", "", "", "") validations[8] = new Validation("reg_user_State", "", "MultiSelect", "Y", "", "", "", "", "") validations[9] = new Validation("reg_user_Zip", "", "Numeric", "Y", 5, 5, "", "", "") validations[10] = new Validation("reg_user_Gender", "", "Radio", "Y", "", "", "", "Gender is required.", "") validations[11] = new Validation("reg_user_DOB", "", "", "", "", "", "", "", "ValidateBirthDate") function ValidateConfirmEmail() { var emailID = document.getElementById("reg_user_EmailAddress"); var confirmID = document.getElementById("reg_user_ConfirmEmail"); if (confirmID && emailID) { if (emailID.value !="" || confirmID.value != "") { if (!IsValidEmailAddress(confirmID.value)) { return ErrMsg_ValidType; } else if (emailID.value != confirmID.value) { return ErrMsg_EmailVerify; } } } return ""; } function ValidateConfirmPassword() { var passwordID = document.getElementById("reg_user_Password"); confirmID = document.getElementById("reg_user_ConfirmPassword"); if (confirmID && passwordID) { if (passwordID.value !="" || confirmID.value != "") { if (passwordID.value != confirmID.value) { return ErrMsg_PasswordVerify; } } } return ""; } function ValidateBirthDate() { var mon = document.getElementById("reg_user_DOBMonth"); var day = document.getElementById("reg_user_DOBDay"); var year = document.getElementById("reg_user_DOBYear"); if (mon.value.length == 0 || day.value.length == 0 || year.value.length == 0) { return "Birth Date is required."; } if (mon.value.length>0 && day.value.length>0 && year.value.length>0 && !isNaN(mon.value) && !isNaN(day.value) && !isNaN(year.value)) { if (year.value.length<4) { return "Please enter a valid birth date. "; } var dob = new Date(parseInt(year.value), parseInt(mon.value) - 1, parseInt(day.value)); if (dob >= new Date()) { return ErrMsg_ValidType; } } else { return ErrMsg_ValidType; } /* the minumum age you want to allow in */ var min_age = 18; var new_year = parseInt(year.value) + min_age; var new_month = parseInt(mon.value) - 1; var new_day = parseInt(day.value); var theirDate = new Date(new_year, new_month, new_day); var today = new Date(); if ( (today.getTime() - theirDate.getTime()) < 0) { return "AstraZeneca will not knowingly collect, use or disclose Personally Identifiable Information from a minor under the age of 18. Please have your parent, guardian, or health care professional request the information on your behalf."; } return ""; }