Skip to content

Commit ee288c1

Browse files
committed
Call the originalSubmitHandler only if array inputs are found in form
1 parent 388d31d commit ee288c1

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

lib/web/mage/validation.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1940,18 +1940,22 @@
19401940
});
19411941
});
19421942

1943-
/**
1944-
* Before submitting the actual form, remove the previously assigned indices
1945-
* @param {Object} form
1946-
*/
1947-
this.options.submitHandler = function (form) {
1948-
originalElements.forEach(function (element) {
1949-
element.element.attr('name', element.name);
1950-
element.element.removeAttr('orig-name');
1951-
});
1952-
/* Call the originalSubmitHandler if it's a function */
1953-
typeof originalSubmitHandler === 'function' ? originalSubmitHandler(form) : void(0);
1954-
};
1943+
if (originalElements.length) {
1944+
/**
1945+
* Before submitting the actual form, remove the previously assigned indices
1946+
* @param {Object} form
1947+
*/
1948+
this.options.submitHandler = function (form, event) {
1949+
originalElements.forEach(function (element) {
1950+
element.element.attr('name', element.name);
1951+
element.element.removeAttr('orig-name');
1952+
});
1953+
1954+
console.error(this.submit)
1955+
/* Call the originalSubmitHandler if it's a function */
1956+
typeof originalSubmitHandler === 'function' ? originalSubmitHandler(form) : form.submit();
1957+
};
1958+
}
19551959
},
19561960

19571961
/**

0 commit comments

Comments
 (0)