Skip to content

Commit 767733e

Browse files
committed
Merge pull request victorjonsson#13 from aL3xa/master
Fixed multiple select input "length" issue
2 parents 4598005 + 6ca5e75 commit 767733e

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
@@ -797,33 +797,8 @@ jQueryFormUtils.validateInput = function(el, language, config, form) {
797797
return true;
798798
}
799799

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

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

0 commit comments

Comments
 (0)