+ var validator = function(reset)
+ {
+ field.className = field.className.replace(/ cbi-input-invalid/g, '');
+
+ // validate value
+ var value = (field.options) ? field.options[field.options.selectedIndex].value : field.value;
+ if( !(((value.length == 0) && optional) || vldcb(value)) )
+ {
+ // invalid
+ field.className += ' cbi-input-invalid';
+ return false;
+ }
+
+ return true;
+ };
+
+ if( ! field.form.cbi_validators )
+ field.form.cbi_validators = [ ];
+
+ field.form.cbi_validators.push(validator);
+ field.onblur = field.onkeyup = field.validate = validator;
+
+ validator();