Skip to content

Commit 9aa58e0

Browse files
committed
Resolve Rule coupon code generate form validation issue23778
1 parent 2e7f039 commit 9aa58e0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

app/code/Magento/SalesRule/view/adminhtml/templates/promo/salesrulejs.phtml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,19 @@ function refreshCouponCodesGrid(grid, gridMassAction, transport) {
2020

2121
function generateCouponCodes(idPrefix, generateUrl, grid) {
2222
$(idPrefix + 'information_fieldset').removeClassName('ignore-validate');
23+
var listInvalidElement = [];
2324
var validationResult = $(idPrefix + 'information_fieldset').select('input',
2425
'select', 'textarea').collect( function(elm) {
25-
return jQuery.validator.validateElement(elm);
26+
var validateOneElementResult = jQuery.validator.validateSingleElement(elm);
27+
if (!validateOneElementResult) {
28+
listInvalidElement.push(elm);
29+
}
30+
return validateOneElementResult;
2631
}).all();
32+
if (listInvalidElement.length) {
33+
listInvalidElement[0].focus();
34+
}
35+
2736
$(idPrefix + 'information_fieldset').addClassName('ignore-validate');
2837

2938
if (!validationResult) {

0 commit comments

Comments
 (0)