From: eav Date: Fri, 26 Dec 2014 07:59:23 +0000 (+0400) Subject: Exclude validates disabled form elements (checkbox, radio) X-Git-Tag: v5.5.1~35^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F6153%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Exclude validates disabled form elements (checkbox, radio) --- diff --git a/js/foundation/foundation.abide.js b/js/foundation/foundation.abide.js index 1b0e981ed..f9f42967c 100644 --- a/js/foundation/foundation.abide.js +++ b/js/foundation/foundation.abide.js @@ -242,7 +242,7 @@ valid_checkbox : function(el, required) { var el = this.S(el), - valid = (el.is(':checked') || !required); + valid = (el.is(':checked') || !required || el.get(0).getAttribute('disabled')); if (valid) { el.removeAttr(this.invalid_attr).parent().removeClass(this.settings.error_class); @@ -257,12 +257,24 @@ var name = el.getAttribute('name'), group = this.S(el).closest('[data-' + this.attr_name(true) + ']').find("[name='"+name+"']"), count = group.length, - valid = false; + valid = false, + disabled = false; // Has to count up to make sure the focus gets applied to the top error - for (var i=0; i < count; i++) { - if (group[i].checked) valid = true; - } + for (var i=0; i < count; i++) { + if( group[i].getAttribute('disabled') ){ + disabled=true; + valid=true; + } else { + if (group[i].checked){ + valid = true; + } else { + if( disabled ){ + valid = false; + } + } + } + } // Has to count up to make sure the focus gets applied to the top error for (var i=0; i < count; i++) {