// REGULAR EXPRESSION DECLARATIONS var reAlphanumeric = /^[#a-zA-Z0-9]+$/ var reWhitespace = /^\s+$/ // Rev : 6/28/02 - BR : added the "-" (hyphen) character to the list of characters allowed in isAlphabetic() fnx. /* Rev : 7/08/02 - BR : added the following characters to the list of characters allowed in isAlphabetic() fnx to account for Euro characters, etc. in names: '`üéâäàåçêëèïîìÄÅÉôöòûùÿÖÜáíóúñÑ */ // Rev : 7/16/02 - BR : added the " " (space) character to the list of characters allowed in isAlphabetic() fnx. var reAlphabetic = /^[ a-zA-Z\-\'\`üéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜáíóúñÑ]+$/ var reInteger = /^\d+$/ var reEmail = /^.+\@.+\..+$/ function isEmpty(s) { return ((s == null) || (s.length == 0) || trim(s) == "") } function trim(str) { if (str != null) { str = new String(str); //appDebug.p("BEFORE: str = " + str + ":str.length = " + str.length); //str = str.replace(/^\s*(.*?)\s*$/, "$1"); var nIndex = 0; while (str.indexOf(" ") == 0) { str = str.substring(1); } while (str.lastIndexOf(" ") == str.length-1 && str.length > 0) { str = str.substring(0, str.length-1); } //appDebug.p("AFTER: str = " + str + ":str.length = " + str.length); } return str; } function isWhitespace (s) { // Is s empty? return (isEmpty(s) || reWhitespace.test(s)); } function isAlphabetic (s) { var i; if (isEmpty(s)) if (isAlphabetic.arguments.length == 1) return true; else return (isAlphabetic.arguments[1] == true); else { //return reAlphabetic.test(s) /* Rev : 7/16/02 - BR : added a test for non-whitespace-only. THis allows space characters in conjunction with word characters but not spaces alone. */ return (reAlphabetic.test(s) && !reWhitespace.test(s)) } } function isAlphanumeric (s) { var i; if (isEmpty(s)) if (isAlphanumeric.arguments.length == 1) return true; else return (isAlphanumeric.arguments[1] == true); else { return reAlphanumeric.test(s) } } function isEmail (s) { if (isEmpty(s)) if (isEmail.arguments.length == 1) return false; else return (isEmail.arguments[1] == true); else { return reEmail.test(s) } } function isInteger (s) { var i; if (isEmpty(s)) if (isInteger.arguments.length == 1) return true; else return (isInteger.arguments[1] == true); return reInteger.test(s) } function isUSPhoneNumber (s) { if (isEmpty(s)) if (isUSPhoneNumber.arguments.length == 1) return true; else return (isUSPhoneNumber.arguments[1] == true); return (isInteger(s) && s.length == 10) } function checkString (theField, emptyOK) { if ((emptyOK == true) && (isEmpty(theField.value))) return true; if (isWhitespace(theField.value)) { return false; } else return true; } function isSSN (s) { if (isEmpty(s)) if (isSSN.arguments.length == 1) return true; else return (isSSN.arguments[1] == true); return (isInteger(s) && s.length == 9); } function isZIPCode (s) { if (isEmpty(s)) { if (isZIPCode.arguments.length == 1) return true; else return (isZIPCode.arguments[1]); } return ((s.length == 5) || (s.length == 7)); } function hasWhitespace (s) { return (s.match(/\s/)!=null); } function isCompaqPassword(strPassword) { // if (strPassword.match(/\'/)||strPassword.match(/\"/)) return false; var badcount; badcount=0; if (!strPassword.match(/\d/)) badcount ++; if (!strPassword.match(/[a-z]/)) badcount ++; if (!strPassword.match(/[A-Z]/)) badcount ++; if (!strPassword.match(/\W/)) badcount ++; if (badcount>=2) return false; return true; } function verifyRenewPassword(f) { var strMsg; var strEmptyFields = ""; var strErrors = ""; if (!isCompaqPassword(f.strPassword.value)) strErrors += "Password must contain three of following requirements:\n"+ " - lowercase, uppercase, digits, special characters.\n"; if (f.strPassword.value.length<8||f.strPassword.value.length>20) strErrors += "Password must be between at 8 and 20 characters long.\n"; if (f.strPassword.value != f.strVerifyPassword.value) strErrors += "Passwords do not match.\n" if (!strEmptyFields && !strErrors) return true; strMsg = "_________________________________________________________\n\n"; strMsg += "The form was not submitted because of the following error(s).\n"; strMsg += "Please correct these error(s) and re-submit.\n"; strMsg += "_________________________________________________________\n\n"; if (strEmptyFields) { strMsg += "- The following required field(s) must be completed:\n" + strEmptyFields + "\n"; if(strErrors) strMsg += "\n"; } strMsg += strErrors; alert(strMsg); return false; } function verifyRenewUsernamePassword(f) { var strMsg; var strEmptyFields = ""; var strErrors = ""; //if (!isAlphanumeric(f.strUsername.value, true)) strErrors += "Username must contain numbers and letters.\n"; if (!isAlphanumeric(f.strUsername.value) && !isEmail(f.strUsername.value)) strErrors += "Username can not be blank.\n"; if (isEmpty(f.strUsername.value)) strEmptyFields += "\tUsername\n"; if (!isCompaqPassword(f.strPassword.value)) strErrors += "Password must contain three of following requirements:\n"+ " - lowercase, uppercase, digits, special characters.\n"; if (f.strPassword.value.length<8||f.strPassword.value.length>20) strErrors += "Password must be between at 8 and 20 characters long.\n"; if (f.strPassword.value != f.strVerifyPassword.value) strErrors += "Passwords do not match.\n" if (!strEmptyFields && !strErrors) return true; strMsg = "_________________________________________________________\n\n"; strMsg += "The form was not submitted because of the following error(s).\n"; strMsg += "Please correct these error(s) and re-submit.\n"; strMsg += "_________________________________________________________\n\n"; if (strEmptyFields) { strMsg += "- The following required field(s) must be completed:\n" + strEmptyFields + "\n"; if(strErrors) strMsg += "\n"; } strMsg += strErrors; alert(strMsg); return false; } function verifyApplicantUN(f) { var strMsg; var strEmptyFields = ""; var strErrors = ""; //if (!isAlphanumeric(f.strUsername.value, true)) strErrors += "Username must contain numbers and letters.\n"; if (!isAlphanumeric(f.strUsername.value) && !isEmail(f.strUsername.value)) strErrors += "Username can not be blank.\n"; if (isEmpty(f.strUsername.value)) strEmptyFields += "\tUsername\n"; if (!isCompaqPassword(f.strPassword.value)) strErrors += "Password must contain three of following requirements:\n"+ " - lowercase, uppercase, digits, special characters.\n"; if (f.strPassword.value.length<8||f.strPassword.value.length>20) strErrors += "Password must be between at 8 and 20 characters long.\n"; if (f.strPassword.value != f.strVerifyPassword.value) strErrors += "Passwords do not match.\n" if (!strEmptyFields && !strErrors) return true; strMsg = "_________________________________________________________\n\n"; strMsg += "The form was not submitted because of the following error(s).\n"; strMsg += "Please correct these error(s) and re-submit.\n"; strMsg += "_________________________________________________________\n\n"; if (strEmptyFields) { strMsg += "- The following required field(s) must be completed:\n" + strEmptyFields + "\n"; if(strErrors) strMsg += "\n"; } strMsg += strErrors; alert(strMsg); return false; } function verifyApplicantPersonal(f) { var strMsg; var strEmptyFields = ""; var strErrors = ""; //Nick: Changed for CAP redesign 7-16-06 //if(f.strHomePhone) var strHomePhone = f.strHomePhone.value; //if(f.strHomePhone3) var strHomePhone = f.strHomePhone1.value + f.strHomePhone2.value + f.strHomePhone3.value; //if(f.strFax) var strFax = f.strFax.value; //if(f.strFax3) var strFax = f.strFax1.value + f.strFax2.value + f.strFax3.value; // var strSocial = f.strSocial1.value + f.strSocial2.value + f.strSocial3.value; //Nick: Changed for CAP redesign 7-28-06 if (!isAlphanumeric(f.strStudentID.value)) strErrors += "Invalid characters in Student ID.\n"; if (isEmpty(f.strStudentID.value)) strEmptyFields += "\tStudentID\n"; //if (GEORegion=='NA') // if(f.strStudentID) //migration path doesn't have studentID in this profile creation page // if (!isInteger(f.strStudentID.value, true)) strErrors += "An invalid student id was provided.\n"; if (!isAlphabetic(f.strLastName.value, false)) strEmptyFields += "\tLast name\n"; if (!isAlphabetic(f.strFirstName.value, false)) strEmptyFields += "\tFirst name\n"; if (!isEmail(f.strEmail.value, false)) strEmptyFields += "\tEmail\n"; //if (GEORegion=='NA' || GEORegion=='LA') { // if (f.nEmailLanguageTypeId.value==0) strErrors += "Preferred Language was not selected.\n"; //} //if (!isAlphabetic(f.strCountry.value, false)) strEmptyFields += "\tCountry\n"; //Nick: Changed for CAP redesign 7-16-06 //if (f.strCountry.value.length==0) strEmptyFields += "\tCountry\n"; //Nick: Changed for CAP redesign 7-16-06 //if (strHomePhone.match(/[^\d|^\-|^\.|^(|^)|^x|^\s]/g)) strErrors += "An invalid home phone number was provided.\n"; //if (strFax.match(/[^\d|^\-|^\.|^(|^)|^x|^\s]/g)) strErrors += "An invalid home fax number was provided.\n"; // if (!isSSN(strSocial, true)) strErrors += "An invalid social security/insurance number was provided.\n"; if (!isAlphanumeric(f.strUsername.value) && !isEmail(f.strUsername.value)) strErrors += "Username can not be blank.\n"; if (isEmpty(f.strUsername.value)) strEmptyFields += "\tUsername\n"; if(!isCompaqPassword(f.strPassword.value, false)) strErrors += "Password must contain three of following requirements:\n - lowercase, uppercase, digits, special characters.\n"; if (f.strPassword.value.length<8||f.strPassword.value.length>20) strErrors += "Password must be between 8 and 20 characters long.\n"; if (f.strPassword.value != f.strVerifyPassword.value) strErrors += "Passwords do not match.\n" //if ((f.acceptTandC!=null) && (!f.acceptTandC.checked)) { // strErrors += "Please view the Terms and Conditions before continuing.\n"; //} if (!strEmptyFields && !strErrors) return true; strMsg = "_________________________________________________________\n\n"; strMsg += "The form was not submitted because of the following error(s).\n"; strMsg += "Please correct these error(s) and re-submit.\n"; strMsg += "_________________________________________________________\n\n"; if (strEmptyFields) { strMsg += "- The following required field(s) must be completed:\n" + strEmptyFields + "\n"; if(strErrors) strMsg += "\n"; } strMsg += strErrors; alert(strMsg); return false; } function verifyApplicantOptinout(f) { var strMsg; var strEmptyFields = ""; var strErrors = ""; if (!isEmail(f.strEmail.value, false)) strEmptyFields += "\tEmail\n"; if (!strEmptyFields && !strErrors) return true; strMsg = "_________________________________________________________\n\n"; strMsg += "The form was not submitted because of the following error(s).\n"; strMsg += "Please correct these error(s) and re-submit.\n"; strMsg += "_________________________________________________________\n\n"; if (strEmptyFields) { strMsg += "- The following required field(s) must be completed:\n" + strEmptyFields + "\n"; if(strErrors) strMsg += "\n"; } strMsg += strErrors; alert(strMsg); return false; } function verifyApplicantPersonalMigration(f) { var strMsg; var strEmptyFields = ""; var strErrors = ""; if(f.strHomePhone) var strHomePhone = f.strHomePhone.value; if(f.strHomePhone3) var strHomePhone = f.strHomePhone1.value + f.strHomePhone2.value + f.strHomePhone3.value; if(f.strFax) var strFax = f.strFax.value; if(f.strFax3) var strFax = f.strFax1.value + f.strFax2.value + f.strFax3.value; // var strSocial = f.strSocial1.value + f.strSocial2.value + f.strSocial3.value; //if (GEORegion=='NA') // if(f.strStudentID) //migration path doesn't have studentID in this profile creation page // if (!isInteger(f.strStudentID.value, false)) strErrors += "An invalid student id was provided.\n"; if (!isAlphabetic(f.strLastName.value, false)) strEmptyFields += "\tLast name\n"; if (!isAlphabetic(f.strFirstName.value, false)) strEmptyFields += "\tFirst name\n"; if (!isEmail(f.strEmail.value, false)) strEmptyFields += "\tEmail\n"; //if (GEORegion=='NA' || GEORegion=='LA') { // if (f.nEmailLanguageTypeId.value==0) strErrors += "Preferred Language was not selected.\n"; //} if (strHomePhone.match(/[^\d|^\-|^\.|^(|^)|^x|^\s]/g)) strErrors += "An invalid home phone number was provided.\n"; if (strFax.match(/[^\d|^\-|^\.|^(|^)|^x|^\s]/g)) strErrors += "An invalid home fax number was provided.\n"; // if (!isSSN(strSocial, true)) strErrors += "An invalid social security/insurance number was provided.\n"; if (!isAlphanumeric(f.strUsername.value) && !isEmail(f.strUsername.value)) strErrors += "Username can not be blank.\n"; if (isEmpty(f.strUsername.value)) strEmptyFields += "\tUsername\n"; if(!isCompaqPassword(f.strPassword.value, false)) strErrors += "Password must contain three of following requirements:\n - lowercase, uppercase, digits, special characters.\n"; if (f.strPassword.value.length<8||f.strPassword.value.length>20) strErrors += "Password must be between 8 and 20 characters long.\n"; if (f.strPassword.value != f.strVerifyPassword.value) strErrors += "Passwords do not match.\n" //if ((f.acceptTandC!=null) && (!f.acceptTandC.checked)) { // strErrors += "Please view the Terms and Conditions before continuing.\n"; //} if (!strEmptyFields && !strErrors) return true; strMsg = "_________________________________________________________\n\n"; strMsg += "The form was not submitted because of the following error(s).\n"; strMsg += "Please correct these error(s) and re-submit.\n"; strMsg += "_________________________________________________________\n\n"; if (strEmptyFields) { strMsg += "- The following required field(s) must be completed:\n" + strEmptyFields + "\n"; if(strErrors) strMsg += "\n"; } strMsg += strErrors; alert(strMsg); return false; } function verifyApplicantPersonalCCR(f) { var strMsg; var strEmptyFields = ""; var strErrors = ""; if(f.strHomePhone) var strHomePhone = f.strHomePhone.value; if(f.strHomePhone3) var strHomePhone = f.strHomePhone1.value + f.strHomePhone2.value + f.strHomePhone3.value; if(f.strFax) var strFax = f.strFax.value; if(f.strFax3) var strFax = f.strFax1.value + f.strFax2.value + f.strFax3.value; // var strSocial = f.strSocial1.value + f.strSocial2.value + f.strSocial3.value; //if (GEORegion=='NA') // if(f.strStudentID) //migration path doesn't have studentID in this profile creation page // if (!isInteger(f.strStudentID.value, false)) strErrors += "An invalid student id was provided.\n"; if (!isAlphabetic(f.strLastName.value, false)) strEmptyFields += "\tLast name\n"; if (!isAlphabetic(f.strFirstName.value, false)) strEmptyFields += "\tFirst name\n"; if (!isEmail(f.strEmail.value, false)) strEmptyFields += "\tEmail\n"; //if (GEORegion=='NA' || GEORegion=='LA') { // if (f.nEmailLanguageTypeId.value==0) strErrors += "Preferred Language was not selected.\n"; //} if (strHomePhone.match(/[^\d|^\-|^\.|^(|^)|^x|^\s]/g)) strErrors += "An invalid home phone number was provided.\n"; if (strFax.match(/[^\d|^\-|^\.|^(|^)|^x|^\s]/g)) strErrors += "An invalid home fax number was provided.\n"; // if (!isSSN(strSocial, true)) strErrors += "An invalid social security/insurance number was provided.\n"; if (!isAlphanumeric(f.strUsername.value) && !isEmail(f.strUsername.value)) strErrors += "Username can not be blank.\n"; if (isEmpty(f.strUsername.value)) strEmptyFields += "\tUsername\n"; if(!isCompaqPassword(f.strPassword.value, false)) strErrors += "Password must contain three of following requirements:\n - lowercase, uppercase, digits, special characters.\n"; if (f.strPassword.value.length<8||f.strPassword.value.length>20) strErrors += "Password must be between 8 and 20 characters long.\n"; if (f.strPassword.value != f.strVerifyPassword.value) strErrors += "Passwords do not match.\n" //if ((f.acceptTandC!=null) && (!f.acceptTandC.checked)) { // strErrors += "Please view the Terms and Conditions before continuing.\n"; //} if (!strEmptyFields && !strErrors) return true; strMsg = "_________________________________________________________\n\n"; strMsg += "The form was not submitted because of the following error(s).\n"; strMsg += "Please correct these error(s) and re-submit.\n"; strMsg += "_________________________________________________________\n\n"; if (strEmptyFields) { strMsg += "- The following required field(s) must be completed:\n" + strEmptyFields + "\n"; if(strErrors) strMsg += "\n"; } strMsg += strErrors; alert(strMsg); return false; } function verifyApplicant(f) { var strMsg; var strEmptyFields = ""; var strErrors = ""; if(f.strHomePhone) var strHomePhone = f.strHomePhone.value; if(f.strHomePhone3) var strHomePhone = f.strHomePhone1.value + f.strHomePhone2.value + f.strHomePhone3.value; if(f.strFax) var strFax = f.strFax.value; if(f.strFax3) var strFax = f.strFax1.value + f.strFax2.value + f.strFax3.value; if(f.strCoPhone) var strCoPhone = f.strCoPhone.value; if(f.strCoPhone3) var strCoPhone = f.strCoPhone1.value + f.strCoPhone2.value + f.strCoPhone3.value; // var strSocial = f.strSocial1.value + f.strSocial2.value + f.strSocial3.value; ////if (GEORegion=='NA') // //if(f.strStudentID) //migration path doesn't have studentID in this profile creation page // if (!isInteger(f.strStudentID.value, true)) strErrors += "An invalid student id was provided.\n"; if (!isAlphanumeric(f.strStudentID.value, false)) strEmptyFields += "\tStudent/ASE ID #\n"; if (!isEmpty(f.strStudentID.value, false)) strEmptyFields += "\tStudent/ASE ID #\n"; if (!isAlphabetic(f.strLastName.value, false)&!hasWhitespace(f.strLastName.value)) strEmptyFields += "\tLast name\n"; if (!isAlphabetic(f.strFirstName.value, false)) strEmptyFields += "\tFirst name\n"; if (!isEmail(f.strEmail.value, false)) strEmptyFields += "\tEmail\n"; //if (GEORegion=='NA' || GEORegion=='LA') { // if (f.nEmailLanguageTypeId.value==0) strErrors += "Preferred Language was not selected.\n"; //} // Rev : 6/17/02 - BR : Home phone not required //if (isEmpty(strHomePhone)) strEmptyFields += "\tPhone\n"; //if (strHomePhone.match(/[^\d|^\-|^\.|^(|^)|^x|^\s]/g)) strErrors += "An invalid home phone number was provided.\n"; //if (!isUSPhoneNumber(strHomePhone, true)) strErrors += "An invalid home phone number was provided.\n"; //if (strFax.match(/[^\d|^\-|^\.|^(|^)|^x|^\s]/g)) strErrors += "An invalid home fax number was provided.\n"; //if (!isUSPhoneNumber(strFax, true)) strErrors += "An invalid home fax number was provided.\n"; // if (!isSSN(strSocial, true)) strErrors += "An invalid social security/insurance number was provided.\n"; //if(!isCompaqPassword(f.strPassword.value)) strErrors += "Password must contain three of following requirements:\n"+ //" - lowercase, uppercase, digits, special characters.\n"; if (f.strPassword.value.length<8||f.strPassword.value.length>20) strErrors += "Password must be between 8 and 20 characters long.\n"; if (f.strCoName!=null) { if (isEmpty(f.strCoName.value)) strEmptyFields += "\Company name\n"; // Rev : 6/17/02 - BR : Removed requirement for Reseller ID //if ((f.strCoAffiliation.value == 'Reseller' || f.strCoAffiliation.value == 'Channel') && isEmpty(f.strResellerID.value, false)) strEmptyFields += "\tReseller ID\n"; //if (isEmpty(f.strResellerID.value)) strEmptyFields += "\tReseller ID\n"; if (isEmpty(f.strCoAddressLine1.value)) strEmptyFields += "\tCompany Address\n"; if (isEmpty(f.strCoCity.value)) strEmptyFields += "\tCompany City\n"; if ((f.strCoState!=null) && (f.strCoState.selectedIndex==0)) strEmptyFields += "\tCompany State\n"; if (GEORegion == 'NA') { //if (!isZIPCode(f.strCoPostalCode.value, false)) strEmptyFields += "\tCompany Postal code\n"; if (isEmpty(f.strCoPostalCode.value)) strEmptyFields += "\tCompany Postal code\n"; } // Rev : 6/19/02 - BR : Business Phone no longer required. //if (isEmpty(strCoPhone)) strEmptyFields += "\tCompany Phone\n"; ////else if (strCoPhone.match(/[^\d|^\-|^\.|^(|^)|^x|^\s]/g)) strErrors += "An invalid Business phone number was provided.\n"; } if (!strEmptyFields && !strErrors) return true; strMsg = "_________________________________________________________\n\n"; strMsg += "The form was not submitted because of the following error(s).\n"; strMsg += "Please correct these error(s) and re-submit.\n"; strMsg += "_________________________________________________________\n\n"; if (strEmptyFields) { strMsg += "- The following required field(s) must be completed:\n" + strEmptyFields + "\n"; if(strErrors) strMsg += "\n"; } strMsg += strErrors; alert(strMsg); return false; } function verifyApplicantCompany(f) { var strMsg; var strEmptyFields = ""; var strErrors = ""; var bCompanyChecked = false; if (isEmpty(f.strCoName.value)) strEmptyFields += "\tCompany name\n"; if(f.bCoSellCompaq.checked || f.bCoServiceCompaq.checked){ // Rev : 6/17/02 - BR : Removed requirement for Reseller ID // (HAS - see below) //if (isEmpty(f.strResellerID.value)) strEmptyFields += "\tReseller ID\n"; } if (isEmpty(f.strCoAddressLine1.value)) strEmptyFields += "\tAddress\n"; if (isEmpty(f.strCoCity.value)) strEmptyFields += "\tCity\n"; if ((f.strCoState!=null) && (f.strCoState.selectedIndex==0)) strEmptyFields += "\tState\n"; if (GEORegion == 'NA') { //if (!isZIPCode(f.strCoPostalCode.value, false)) strEmptyFields += "\tPostal code\n"; if (isEmpty(f.strCoPostalCode.value)) strEmptyFields += "\tPostal code\n"; } // Rev : 6/19/02 - BR : Business Phone no longer required. if (!isEmpty(f.strCoPhone.value)) { if (f.strCoPhone.value.match(/[^\d|^\-|^\.|^(|^)|^x|^\s]/g)) strErrors += "An invalid business phone number was provided.\n"; } if (!isEmpty(f.strCoFax.value)) { if (f.strCoFax.value.match(/[^\d|^\-|^\.|^(|^)|^x|^\s]/g)) strErrors += "An invalid business fax number was provided.\n"; } // Rev : 3/18/03 - HAS : added requirement for Reseller ID back bCompanyChecked=f.bCoSellCompaq.checked||f.bCoServiceCompaq.checked; if (bCompanyChecked) if (isEmpty(f.strResellerID.value)) strErrors += "\tPlease provide your Outlet/Auth ID\n"; { } if (!strEmptyFields && !strErrors) return true; strMsg = "_________________________________________________________\n\n"; strMsg += "The form was not submitted because of the following error(s).\n"; strMsg += "Please correct these error(s) and re-submit.\n"; strMsg += "_________________________________________________________\n\n"; if (strEmptyFields) { strMsg += "- The following required field(s) must be completed:\n" + strEmptyFields + "\n"; if(strErrors) strMsg += "\n"; } strMsg += strErrors; alert(strMsg); return false; } function verifyApplicantCompany_Migration(f) { var strMsg; var strEmptyFields = ""; var strErrors = ""; var bCompanyChecked = false; if (isEmpty(f.strCoName.value)) strEmptyFields += "\tCompany name\n"; if (isEmpty(f.strCoAddressLine1.value)) strEmptyFields += "\tAddress\n"; if (isEmpty(f.strCoCity.value)) strEmptyFields += "\tCity\n"; if ((f.strCoState!=null) && (f.strCoState.selectedIndex==0)) strEmptyFields += "\tState\n"; if (GEORegion == 'NA') { //if (!isZIPCode(f.strCoPostalCode.value, false)) strEmptyFields += "\tPostal code\n"; if (isEmpty(f.strCoPostalCode.value)) strEmptyFields += "\tPostal code\n"; } bCompanyChecked=f.bCoSellCompaq.checked||f.bCoServiceCompaq.checked; if (bCompanyChecked) { if (isEmpty(f.strResellerID.value)) strErrors += "\tPlease provide your Outlet/Auth ID\n"; } if (!strEmptyFields && !strErrors) return true; strMsg = "_________________________________________________________\n\n"; strMsg += "The form was not submitted because of the following error(s).\n"; strMsg += "Please correct these error(s) and re-submit.\n"; strMsg += "_________________________________________________________\n\n"; if (strEmptyFields) { strMsg += "- The following required field(s) must be completed:\n" + strEmptyFields + "\n"; if(strErrors) strMsg += "\n"; } strMsg += strErrors; alert(strMsg); return false; } function verifyApplicantCompany_CCR(f) { var strMsg; var strEmptyFields = ""; var strErrors = ""; var bCompanyChecked = false; if (isEmpty(f.strCoName.value)) strEmptyFields += "\tCompany name\n"; if (isEmpty(f.strCoAddressLine1.value)) strEmptyFields += "\tAddress\n"; if (isEmpty(f.strCoCity.value)) strEmptyFields += "\tCity\n"; if ((f.strCoState!=null) && (f.strCoState.selectedIndex==0)) strEmptyFields += "\tState\n"; if (GEORegion == 'NA') { //if (!isZIPCode(f.strCoPostalCode.value, false)) strEmptyFields += "\tPostal code\n"; if (isEmpty(f.strCoPostalCode.value)) strEmptyFields += "\tPostal code\n"; } bCompanyChecked=f.bCoSellCompaq.checked||f.bCoServiceCompaq.checked; if (bCompanyChecked) { if (isEmpty(f.strResellerID.value)) strErrors += "\tPlease provide your Outlet/Auth ID\n"; } if (!strEmptyFields && !strErrors) return true; strMsg = "_________________________________________________________\n\n"; strMsg += "The form was not submitted because of the following error(s).\n"; strMsg += "Please correct these error(s) and re-submit.\n"; strMsg += "_________________________________________________________\n\n"; if (strEmptyFields) { strMsg += "- The following required field(s) must be completed:\n" + strEmptyFields + "\n"; if(strErrors) strMsg += "\n"; } strMsg += strErrors; alert(strMsg); return false; } function verifyCompaqDevTracking(f) { var strMsg; var strEmptyFields = ""; var strErrors = ""; if (f.chkNA.checked==true) { if (!isAlphanumeric(f.strBadgeNo.value, false)) strEmptyFields += "\tBadge Number\n"; if (f.bDevPlan.checked){ if (!isAlphabetic(f.strUnitMgr.value, false)) strEmptyFields += "\tUnit manager\n"; if (!isEmail(f.strCertFocalEmail.value, false)) strEmptyFields += "\tCertification focal email\n"; } if (!strEmptyFields && !strErrors) return true; strMsg = "_________________________________________________________\n\n"; strMsg += "The form was not submitted because of the following error(s).\n"; strMsg += "Please correct these error(s) and re-submit.\n"; strMsg += "_________________________________________________________\n\n"; if (strEmptyFields) { strMsg += "- The following required field(s) must be completed:\n" + strEmptyFields + "\n"; if(strErrors) strMsg += "\n"; } strMsg += strErrors; alert(strMsg); return false; } else return true; } function CForm(form){ this.oldValues = new Array(); this.form = form; for(var i=0; i < this.form.length; i++){ switch(this.form.elements[i].type){ case "checkbox": case "radio": this.oldValues[i] = this.form.elements[i].checked; break; case "select-one": case "select-multiple": this.oldValues[i] = this.form.elements[i].selectedIndex; break; default: this.oldValues[i] = this.form.elements[i].value; break; } } this.valuesChanged = function(){ var changed = false; for(var i=0; i < this.form.length; i++){ switch(this.form.elements[i].type){ case "checkbox": case "radio": if(this.oldValues[i] != this.form.elements[i].checked) changed=true; break; case "select-one": case "select-multiple": if(this.oldValues[i] != this.form.elements[i].selectedIndex) changed=true; break; default: if(this.oldValues[i] != this.form.elements[i].value) changed=true; break; } } if(changed) this.form.elements['valuesChanged'].value = true; // - WORK AROUND : SETS ALL THE FIELDS DISABLED TO false for(var i=0; i < this.form.length; i++) this.form[i].disabled = false; } } function CCompanyForm(){ this.disableAll = m_disableAll; this.disableReseller = m_disableReseller; this.enableAll = m_enableAll; this.init = m_init; function m_init(){ this.form = mainForm;} function m_disableAll(switchbox){ this.init(); if (switchbox.checked) { if(!confirm('Clear all fields?')) return false; for (i=0; i < this.form.length;i++) { if (this.form[i]==switchbox) continue; switch(this.form[i].type){ case 'button': case 'hidden': case 'submit': case 'reset': continue; break; case 'checkbox': case 'radio': this.form[i].checked = false; break; case 'text': case 'textarea': this.form[i].value = ""; break; case 'select-one': case 'select-multiple': this.form[i].selectedIndex = 0; break; } this.form[i].disabled = true; } }else{ for (i=0; i < this.form.length;i++) { this.form[i].disabled = false; /*switch(this.form[i].name){ case 'strCoName': case 'strCoAffiliation': case 'bCoSellCompaq': case 'bCoServiceCompaq': this.form[i].disabled = false; break; }*/ } } } function m_disableReseller(switchbox){return} /*function m_disableReseller(switchbox){ this.init(); if (!this.form['bCoSellCompaq'].checked && !this.form['bCoServiceCompaq'].checked) { if(!confirm('Clear reseller fields?')) return false; for (i=0; i < this.form.length;i++) { switch(this.form[i].name){ case 'NotApp': case 'strCoName': case 'strCoAffiliation': case 'bCoSellCompaq': case 'bCoServiceCompaq': continue; break; } switch(this.form[i].type){ case 'button': case 'hidden': case 'submit': case 'reset': continue; break; case 'checkbox': case 'radio': this.form[i].checked = false; break; case 'text': case 'textarea': this.form[i].value = ""; break; case 'select-one': case 'select-multiple': this.form[i].selectedIndex = 0; break; } this.form[i].disabled = true; } }else{ for (i=0; i < this.form.length;i++) { this.form[i].disabled = false; } } } */ function m_enableAll(){ for (i=0; i < this.form.length;i++) { this.form[i].disabled = false; } } } function CDevTrackingForm(){ this.disableAll = m_disableAll; this.disableDevPlan = m_disableDevPlan; this.init = m_init; function m_init(){ this.form = mainForm;} function m_disableAll(switchbox){ this.init(); if (!switchbox.checked) { if(!confirm('Clear all fields?')) return false; for (i=0; i < this.form.length;i++) { if (this.form[i]==switchbox) continue; switch(this.form[i].type){ case 'button': case 'hidden': case 'submit': case 'reset': continue; break; case 'checkbox': case 'radio': this.form[i].checked = false; break; case 'text': case 'textarea': this.form[i].value = ""; break; case 'select-one': case 'select-multiple': this.form[i].selectedIndex = 0; break; } this.form[i].disabled = true; } }else{ for (i=0; i < this.form.length;i++) { this.form[i].disabled = false; } } } function m_disableDevPlan(switchbox){ this.init(); if (!switchbox.checked) { if(!confirm('Clear Developmental Plan fields?')) return false; for (i=0; i < this.form.length;i++) { if (this.form[i]==switchbox) continue; switch(this.form[i].name){ case 'strBadgeNo': case 'strSiteCode': case 'strBusinessUnit': case 'chkNA': continue; break; } switch(this.form[i].type){ case 'button': case 'hidden': case 'submit': case 'reset': continue; break; case 'checkbox': case 'radio': this.form[i].checked = false; break; case 'text': case 'textarea': this.form[i].value = ""; break; case 'select-one': case 'select-multiple': this.form[i].selectedIndex = 0; break; } this.form[i].disabled = true; } }else{ for (i=0; i < this.form.length;i++) { this.form[i].disabled = false; } } } }