]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Exclude validates disabled form elements (checkbox, radio) 6153/head
authoreav <mr.efrem@gmail.com>
Fri, 26 Dec 2014 07:59:23 +0000 (11:59 +0400)
committereav <mr.efrem@gmail.com>
Fri, 26 Dec 2014 07:59:23 +0000 (11:59 +0400)
js/foundation/foundation.abide.js

index 1b0e981edd09fd910afd5a3e86d2af7218af937b..f9f42967c177b58d161a8ad32aa604f8ed77a447 100644 (file)
 
     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);
       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++) {