From 6ca5e752d17563c7ffa992d8357f130c80f84c4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleksandar=20Blagoti=C4=87?= Date: Sun, 13 May 2012 21:23:16 +0200 Subject: [PATCH] Made length property compatible with multiple selects --- jquery.formvalidator.js | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/jquery.formvalidator.js b/jquery.formvalidator.js index b8bf32c..7a5ce53 100755 --- a/jquery.formvalidator.js +++ b/jquery.formvalidator.js @@ -796,33 +796,8 @@ jQueryFormUtils.validateInput = function(el, language, config, form) { return true; } - // Select lists with multiple options (most likely at least) - if(typeof value == 'object') { - var createFakeInput = function(val) { - var fake = el.clone(false); - fake - .removeAttr('multiple') - .children() - .remove(); - - $('').appendTo(fake); - return fake; - }; - if(!value) { - return jQueryFormUtils.validateInput(createFakeInput(''), language, config, form); - } - else { - var isValid; - for(var i=0; i < value.length; i++) { - isValid = jQueryFormUtils.validateInput(createFakeInput(value[i]), language, config, form); - if(isValid !== true) - return isValid; - } - return true; - } - } - - value = $.trim(value); + value = value || ''; // coerce to empty string if null + var validationRules = el.attr(config.validationRuleAttribute); // see if form element has inline err msg attribute