From 264223006ca30aaf57eb070f6599829ab0b012cf Mon Sep 17 00:00:00 2001 From: RomanKis Date: Fri, 15 Mar 2019 18:21:11 +0200 Subject: [PATCH] #21734 Error in JS validation rule --- .../Magento/Ui/view/base/web/js/lib/validation/rules.js | 6 +++--- lib/web/mage/validation.js | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js b/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js index cbfc0dae90dda..831f11976fb2f 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js @@ -919,12 +919,12 @@ define([ ], 'validate-per-page-value-list': [ function (value) { - var isValid = utils.isEmpty(value), + var isValid = true, values = value.split(','), i; - if (isValid) { - return true; + if (utils.isEmpty(value)) { + return isValid; } for (i = 0; i < values.length; i++) { diff --git a/lib/web/mage/validation.js b/lib/web/mage/validation.js index a742b8e6bbb27..cd3d3bea4eabf 100644 --- a/lib/web/mage/validation.js +++ b/lib/web/mage/validation.js @@ -1425,10 +1425,14 @@ ], 'validate-per-page-value-list': [ function (v) { - var isValid = !$.mage.isEmpty(v), + var isValid = true, values = v.split(','), i; + if ($.mage.isEmpty(v)) { + return isValid; + } + for (i = 0; i < values.length; i++) { if (!/^[0-9]+$/.test(values[i])) { isValid = false;