/* ** This version of the function takes into account ** fields that may have multiple values and loops through ** them. For example, if the text field quantities appears ** twice on a page so that it will return a comma dilineated ** list, this function will handle it. */ function testEmpty(field, Caption) { if(field.length==null){ field.value = allTrim(field.value); if (field.value == "") { alert('Please fill out the "' + Caption + '" before continuing.'); field.focus(); return false; } else { return true; } } else { for (var k = 0; k < field.length; k++) { field[k].value = allTrim(field[k].value); if (field[k].value == "") { alert('Please fill out all of the "' + Caption + '" fields before continuing.'); field[k].focus(); return false; } } } return true; } function allTrim(aStr) { var i = 0; var j = 0; if (aStr == "") { return ""; } if ((aStr.length == 1) && (aStr.charAt(0) != " ")) { return aStr; } for (i = 0; i < aStr.length; i++) { if ((aStr.charAt(i) != " ") && (aStr.charAt(i) != "\n") && (aStr.charAt(i) != "\t") && (aStr.charAt(i) != "\n")) { break; } } if (i >= aStr.length - 1) { return ""; } for (j = aStr.length - 1; j > 0; j--) { if ((aStr.charAt(j) != " ") && (aStr.charAt(j) != "\n") && (aStr.charAt(j) != "\t") && (aStr.charAt(j) != "\n")) { break; } } return aStr.substring(i, j + 1); } /* Copyright © 2000-2002 Trapezoid, Inc. All Rights Reserved. */