// JavaScript Document' function imposeMaxLength(Object, MaxLen){ return (Object.value.length <= MaxLen); } function placeFocus(){ if (document){ document.vendorform.businessname.focus(); } } function validateForm(){ if (document){ var doc = document.vendorform; if (doc.accept.checked == false){ alert("Please read the disclaimer on top of the form and check the box below it to accept the stated term and condition."); doc.accept.focus(); return false; } if (doc.businessname.value == ""){ alert("Business Name is required!"); doc.businessname.focus(); return false; } if (doc.taxid.value == ""){ alert("Federal Tax ID is required!"); doc.taxid.focus(); return false; } if (doc.annualsale.value != ""){ var Chars = "0123456789.,"; for (var i = 0; i < doc.annualsale.value.length; i++) { if (Chars.indexOf(doc.annualsale.value.charAt(i)) == -1) { alert("Invalid Character(s)\n\nOnly numbers (0-9), a comma, and a period are allowed in the Annual Sale field."); doc.annualsale.focus(); doc.annualsale.select(); return false; } } } if (doc.annualrevenue.value != ""){ var Chars = "0123456789.,"; for (var i = 0; i < doc.annualrevenue.value.length; i++) { if (Chars.indexOf(doc.annualrevenue.value.charAt(i)) == -1) { alert("Invalid Character(s)\n\nOnly numbers (0-9), a comma, and a period are allowed in the Annual Revenue field."); doc.annualrevenue.focus(); doc.annualrevenue.select(); return false; } } } if (doc.dunnsnumber.value == ""){ alert("Dunns Number is required!"); doc.dunnsnumber.focus(); return false; } if (doc.street.value == ""){ alert("Street Address is required!"); doc.street.focus(); return false; } if (doc.city.value == ""){ alert("City is required!"); doc.city.focus(); return false; } if (doc.state.value == ""){ alert("State is required!"); doc.state.focus(); return false; } if (doc.zip.value == ""){ alert("Zip code is required!"); doc.zip.focus(); return false; } if (doc.PhoneNum.value == ""){ alert("Phone number is required!"); doc.PhoneNum.focus(); return false; }else{ var Chars = "0123456789.()- "; for (var i = 0; i < doc.PhoneNum.value.length; i++) { if (Chars.indexOf(doc.PhoneNum.value.charAt(i)) == -1) { alert("Invalid Character(s) for Phone Number."); doc.PhoneNum.focus(); doc.PhoneNum.select(); return false; break; } } } if (!isUrl(doc.website.value)){ alert("The web site's URL you entered seems to be incorrect. Please try again.") doc.website.focus(); doc.website.select(); return false; } /* if (doc.litigation.value == ""){ alert("The Recent (past 5 years), Current, or Pending Litigations field is required!"); doc.litigation.focus(); return false; } if (doc.bankrupcies.value == ""){ alert("The Recent (past 5 years), Current, or Pending Bankrupcies field is required!"); doc.bankrupcies.focus(); return false; } */ if ((doc.relationshipRadio[0].checked == false) && (doc.relationshipRadio[1].checked == false)){ alert("Please select Yes/No for \"Relationship with the participating companies?\"\nIf you select \"Yes\", enter company names in the box provided.\n\nTo see a list of participating companies, click on the \"participating companies\" link on the form."); return false; } if (doc.relationshipRadio[0].checked == true && doc.company1.value == "" && doc.company2.value == ""){ alert("Enter company names in the box provided."); doc.company1.focus(); return false; } if (doc.contactname.value == ""){ alert("Please enter primary contact name"); doc.contactname.focus(); return false; } if (doc.officephone.value == ""){ alert("Office Phone number is required!"); doc.officephone.focus(); return false; }else{ var Chars = "0123456789.()- "; for (var i = 0; i < doc.officephone.value.length; i++) { if (Chars.indexOf(doc.officephone.value.charAt(i)) == -1) { alert("Invalid Character(s) for Office Phone Number."); doc.officephone.focus(); doc.officephone.select(); return false; break; } } } if (doc.cellphone.value != ""){ var Chars = "0123456789.()- "; for (var i = 0; i < doc.cellphone.value.length; i++) { if (Chars.indexOf(doc.cellphone.value.charAt(i)) == -1) { alert("Invalid Character(s) for Cell Phone Number."); doc.cellphone.focus(); doc.cellphone.select(); return false; break; } } } if (doc.email.value == ""){ alert("Email address is required in the Primary Contact information section."); doc.email.focus(); return false; }else{ var email = doc.email.value; if (email.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1){ alert("Please enter a valid email address"); doc.email.focus(); doc.email.select(); return false; } } if (doc.workyear.value == ""){ alert("Please enter number of years you've been working at this company."); doc.workyear.focus(); return false; } } return true; } function isUrl(s) { var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/ return regexp.test(s); }