Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#21734 Error in JS validation rule #21776

Merged
merged 2 commits into from
Mar 29, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -920,12 +920,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 @@ -1431,10 +1431,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