// function areAllReqFilled(formName)
// function: To see if all Required fields are filled out
// parameters: formName - the "name" value of the form
function areAllReqFilled(formName) {
if (areAllReqFilledGen(formName)){
return true;
} else {
return false;
}
}
function areAllReqFilledGen(formName){
alertMsg = "
";
errorCount = 0;
for (x=0; x' + ReqFieldsDisplayNames[x] + '';
errorCount++;
}
} else if (document.forms[formName].elements[ReqFieldsList[x]].type == "select-one") {
if (document.forms[formName].elements[ReqFieldsList[x]].selectedIndex == 0){
alertMsg += '- ' + ReqFieldsDisplayNames[x] + '
';
errorCount++;
}
} else if (document.forms[formName].elements[ReqFieldsList[x]].type == "hidden") {
// do nothing
} else {
if (getIndex(formName, ReqFieldsList[x]) == 0) {
alertMsg += '- ' + ReqFieldsDisplayNames[x] + '
';
errorCount++;
}
}
}
}
if (alertMsg != "") { // there are errors so call Alert and return false
alertMsg = 'Please fill in the following required fields:
' + alertMsg;
alertMsg += '
';
//figure out which Alert window to use
if (errorCount == 1) {
Alert(alertMsg);
} else if (errorCount <= 5) {
Alert1(alertMsg);
} else {
Alert2(alertMsg);
}
return false;
} else { // no errors so return true and allow parent form submission
return true;
}
}
function areAllReqFilledEM(formName){
alertMsg = "";
errorCount = 0;
for (i=0; i' + ReqFieldsDisplayNames[i] + '';
errorCount++;
}
}
}
if (document.forms[formName].elements[extColor].selectedIndex == 0){
alertMsg += '- Exterior Color
';
errorCount++;
}
if (document.forms[formName].elements[year].selectedIndex == 0){
alertMsg += '- Year
';
errorCount++;
}
if (document.forms[formName].elements[cylinder].selectedIndex == 0){
alertMsg += '- Engine Type
';
errorCount++;
}
if (document.forms[formName].elements[transmission].selectedIndex == 0){
alertMsg += '- Transmission Type
';
errorCount++;
}
if (document.forms[formName].elements[doorscount].selectedIndex == 0){
alertMsg += '- Number of Doors
';
errorCount++;
}
if (getIndex(formName, condition) == 0){
alertMsg += '- Condition
';
errorCount++;
}
if (getIndex(formName,vehInspection ) == 0){
alertMsg += '- Vehicle Inspection
';
errorCount++;
}
if (getIndex(formName, titleType) == 0){
alertMsg += '- Vehicle Title Type
';
errorCount++;
}
if (alertMsg != "") { // there are errors so call Alert and return false
alertMsg = 'Please fill in the following required fields:
' + alertMsg;
alertMsg += '
';
//figure out which Alert window to use
if (errorCount == 1) {
Alert(alertMsg);
} else if (errorCount <= 5) {
Alert1(alertMsg);
} else {
Alert2(alertMsg);
}
return false;
} else { // no errors so return true and allow parent form submission
return true;
}
}
function getIndex(formname, element){
var length = document.forms[formname].elements[element].length;
var checked = 0;
for (i=0; i 5){
Alert("Please specify only 5 digits zip code.");
return false;
} if (isNaN(str) || str < 0){
Alert("Please specify a valid zip code.");
return false;
}
return true;
}
// function isAlphaNumeric(str)
// function: To check if the string entered contains only letters and numbers
// parameters: str - field value to check
function isAlphaNumeric(str) {
var validAlpha = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789";
var valid = 1;
for (i=0; i < str.length; i++) {
if (validAlpha.indexOf(str.charAt(i)) == -1) {
valid = 0;
}
}
if (!valid) {
Alert("Only alphabet letters and numbers are allowed.");
return false;
} else {
return true;
}
}
function isQuoteChar(str) {
var specialCharAvailable = false;
if (str.indexOf('"') != -1 || str.indexOf("'") != -1)
specialCharAvailable = true;
return specialCharAvailable ;
}
function isPositiveInt(str){
var isNotNumber = false;
isNotNumber = isNaN(str);
if(str == ''){
return false;
}
else if(isNotNumber){
return false;
}
else {
if(str <= 0){
return false;
}
}
return true;
}
function areAllReqFilledGenMessage(formName){
alertMsg = "";
for (x=0; x