From 2aed83fa86e950038a4103ffef8b5d90c7d7428d Mon Sep 17 00:00:00 2001 From: David Grudl Date: Wed, 29 Mar 2017 18:34:06 +0200 Subject: [PATCH] netteForms.js: fixed 'Too much recursions' [Closes #143] --- src/assets/netteForms.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/assets/netteForms.js b/src/assets/netteForms.js index b851d709d..57de24d45 100644 --- a/src/assets/netteForms.js +++ b/src/assets/netteForms.js @@ -320,6 +320,8 @@ }; + var preventFiltering = false; + /** * Validates single rule. */ @@ -333,8 +335,12 @@ op = op.replace(/\\/g, ''); var arr = Nette.isArray(arg) ? arg.slice(0) : [arg]; - for (var i = 0, len = arr.length; i < len; i++) { - arr[i] = Nette.expandRuleArgument(elem.form, arr[i]); + if (!preventFiltering) { + preventFiltering = true; + for (var i = 0, len = arr.length; i < len; i++) { + arr[i] = Nette.expandRuleArgument(elem.form, arr[i]); + } + preventFiltering = false; } return Nette.validators[op] ? Nette.validators[op](elem, Nette.isArray(arg) ? arr : arr[0], value.value, value)