Skip to content

Commit

Permalink
#21734 Error in JS validation rule
Browse files Browse the repository at this point in the history
  • Loading branch information
kisroman committed Mar 18, 2019
1 parent 71e61a7 commit 6bb24ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
6 changes: 5 additions & 1 deletion lib/web/mage/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6bb24ef

Please sign in to comment.