From 08b6302adbd8ebaab6c289aa795df68a6a52f252 Mon Sep 17 00:00:00 2001 From: Darkzor Date: Mon, 7 Jan 2019 14:09:44 +0200 Subject: [PATCH] Updated runValidators function Added a check for an "is-custom" parameter to bypass validation checks on the field itself, within the runValidators function, in case we need it for an advanced custom rule. Changes were made so that we can have a solution for the following scenario: there are two fields, f1 that doesn't have a required parameter and f2 and we want to show an error under f1 if neither fields are valid from the app logic perspective. --- js/validator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/validator.js b/js/validator.js index 6311a22..9da97b9 100644 --- a/js/validator.js +++ b/js/validator.js @@ -203,7 +203,7 @@ $.each(this.validators, $.proxy(function (key, validator) { var error = null - if ((getValue($el) || $el.attr('required')) && + if ((getValue($el) || $el.attr('required') || $el.data('is-custom')) && ($el.attr('data-' + key) !== undefined || key == 'native') && (error = validator.call(this, $el))) { error = getErrorMessage(key) || error