validateMaxLength.js
Summary
No overview generated for 'validateMaxLength.js'
Method Summary
|
static Object
|
validateMaxLength(form)
A field is considered valid if less than the specified maximum.
|
function validateMaxLength(form) {
var isValid = true;
var focusField = null;
var i = 0;
var fields = new Array();
oMaxLength = eval('new ' + retrieveFormName(form) + '_maxlength()');
for (x in oMaxLength) {
var field = form[oMaxLength[x][0]];
if ((field.type == 'hidden' ||
field.type == 'text' ||
field.type == 'password' ||
field.type == 'textarea') &&
field.disabled == false) {
var iMax = parseInt(oMaxLength[x][2]("maxlength"));
if (field.value.length > iMax) {
if (i == 0) {
focusField = field;
}
fields[i++] = oMaxLength[x][1];
isValid = false;
}
}
}
if (fields.length > 0) {
focusField.focus();
alert(fields.join('\n'));
}
return isValid;
}
Copyright ¬ 2000-2005 - Apache Software Foundation
Documentation generated by
JSDoc on Wed Nov 16 02:51:00 2005