From 6a6d6df81148180daee5cbb113cb281ca423360f Mon Sep 17 00:00:00 2001 From: Marius Olbertz Date: Tue, 18 Oct 2016 20:32:39 +0200 Subject: [PATCH] Make Abide also re-validate dependent fields (with equalto). Addresses #9138. --- js/foundation.abide.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/js/foundation.abide.js b/js/foundation.abide.js index 5c8750da3..b58cb2262 100644 --- a/js/foundation.abide.js +++ b/js/foundation.abide.js @@ -278,6 +278,19 @@ class Abide { var goodToGo = [clearRequire, validated, customValidator, equalTo].indexOf(false) === -1; var message = (goodToGo ? 'valid' : 'invalid') + '.zf.abide'; + if (goodToGo) { + // Re-validate inputs that depend on this one with equalto + const dependentElements = this.$element.find(`[data-equalto="${$el.attr('id')}"]`); + if (dependentElements.length) { + let _this = this; + dependentElements.each(function() { + if ($(this).val()) { + _this.validateInput($(this)); + } + }); + } + } + this[goodToGo ? 'removeErrorClasses' : 'addErrorClasses']($el); /** -- 2.47.2