]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Merge branch 'develop' into feature/abide-novalidate
authorSassNinja <kai.falkowski@gmail.com>
Tue, 13 Aug 2019 07:54:36 +0000 (09:54 +0200)
committerSassNinja <kai.falkowski@gmail.com>
Tue, 13 Aug 2019 07:54:36 +0000 (09:54 +0200)
1  2 
js/foundation.abide.js
test/javascript/components/abide.js

index 6642f2517ce11552d3e88dfd0ecee82ada5382a0,7891bda51c11c29f22e0d8ed2b1fc297a1e3e68b..ed8c94ee86f4c47b26b5fb662acb3b3c5765b1fb
@@@ -452,14 -457,21 +504,27 @@@ class Abide extends Plugin 
    validateForm() {
      var acc = [];
      var _this = this;
+     var checkboxGroupName;
+     // Remember first form submission to prevent specific checkbox validation (more than one required) until form got initially submitted
+     if (!this.initialized) {
+       this.initialized = true;
+     }
  
 +    // skip validation if disabled
 +    if (this._validationIsDisabled()) {
 +      this.formnovalidate = null;
 +      return true;
 +    }
 +
      this.$inputs.each(function() {
+       // Only use one checkbox per group since validateCheckbox() iterates over all associated checkboxes
+       if ($(this)[0].type === 'checkbox') {
+         if ($(this).attr('name') === checkboxGroupName) return true;
+         checkboxGroupName = $(this).attr('name');
+       }
        acc.push(_this.validateInput($(this)));
      });
  
Simple merge