Skip to content

Commit 6ca5e75

Browse files
committed
Made length property compatible with multiple selects
1 parent d82a497 commit 6ca5e75

File tree

1 file changed

+2
-27
lines changed

1 file changed

+2
-27
lines changed

jquery.formvalidator.js

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -796,33 +796,8 @@ jQueryFormUtils.validateInput = function(el, language, config, form) {
796796
return true;
797797
}
798798

799-
// Select lists with multiple options (most likely at least)
800-
if(typeof value == 'object') {
801-
var createFakeInput = function(val) {
802-
var fake = el.clone(false);
803-
fake
804-
.removeAttr('multiple')
805-
.children()
806-
.remove();
807-
808-
$('<option value="'+val+'" selected="selected"></option>').appendTo(fake);
809-
return fake;
810-
};
811-
if(!value) {
812-
return jQueryFormUtils.validateInput(createFakeInput(''), language, config, form);
813-
}
814-
else {
815-
var isValid;
816-
for(var i=0; i < value.length; i++) {
817-
isValid = jQueryFormUtils.validateInput(createFakeInput(value[i]), language, config, form);
818-
if(isValid !== true)
819-
return isValid;
820-
}
821-
return true;
822-
}
823-
}
824-
825-
value = $.trim(value);
799+
value = value || ''; // coerce to empty string if null
800+
826801
var validationRules = el.attr(config.validationRuleAttribute);
827802

828803
// see if form element has inline err msg attribute

0 commit comments

Comments
 (0)