Skip to content

Commit 2acf55b

Browse files
ENGCOM-5174: issue fixed #8258 - assign indices for all array inputs so that validation works properly #15383
- Merge Pull Request #15383 from jayankaghosh/magento2:issue-8258 - Merged commits: 1. 113440f 2. 874d770 3. 84355a3 4. d5c41b6 5. 156ac16 6. 65a2c17 7. 97c03f5 8. 224f737 9. 908100b 10. 38b9709 11. 388d31d 12. ee288c1 13. 11fb048 14. 38cec68 15. 2b231c5 16. 2816a49
2 parents 8b835af + 2816a49 commit 2acf55b

File tree

11 files changed

+22
-16
lines changed

11 files changed

+22
-16
lines changed

dev/tests/functional/tests/app/Magento/CheckoutAgreements/Test/Block/Adminhtml/Block/Agreement/Edit/AgreementsForm.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<input>select</input>
1919
</mode>
2020
<stores>
21-
<selector>[name="stores[]"]</selector>
21+
<selector>[name="stores[0]"]</selector>
2222
<input>multiselectgrouplist</input>
2323
</stores>
2424
<checkbox_text />

dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Queue/Edit/QueueForm.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<selector>input[name='start_at']</selector>
1212
</queue_start_at>
1313
<stores>
14-
<selector>select[name="stores[]"]</selector>
14+
<selector>select[name="stores[0]"]</selector>
1515
<input>multiselectgrouplist</input>
1616
</stores>
1717
<newsletter_subject>

dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/Sales/Coupons/Filter.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<input>select</input>
3030
</price_rule_type>
3131
<order_statuses>
32-
<selector>[name="order_statuses[]"]</selector>
32+
<selector>[name="order_statuses[0]"]</selector>
3333
<input>multiselect</input>
3434
</order_statuses>
3535
<rules_list>

dev/tests/functional/tests/app/Magento/Reports/Test/Block/Adminhtml/Sales/TaxRule/Filter.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<input>select</input>
2424
</show_order_statuses>
2525
<order_statuses>
26-
<selector>[name="order_statuses[]"]</selector>
26+
<selector>[name="order_statuses[0]"]</selector>
2727
<input>multiselect</input>
2828
</order_statuses>
2929
<show_empty_rows>

dev/tests/functional/tests/app/Magento/Review/Test/Block/Adminhtml/Rating/Edit/RatingForm.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<strategy>css selector</strategy>
1313
<fields>
1414
<stores>
15-
<selector>[name="stores[]"]</selector>
15+
<selector>[name="stores[0]"]</selector>
1616
<input>multiselectgrouplist</input>
1717
</stores>
1818
<is_active>

dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Report/Filter/Form.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<input>select</input>
2727
</show_order_statuses>
2828
<order_statuses>
29-
<selector>[name="order_statuses[]"]</selector>
29+
<selector>[name="order_statuses[0]"]</selector>
3030
<input>multiselect</input>
3131
</order_statuses>
3232
<show_actual_columns>

dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/Instance/Edit/Tab/ParametersType/RecentlyComparedProducts.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
</page_size>
1313
<show_attributes>
1414
<selector>
15-
.control [name="parameters[show_attributes][]"]
15+
.control [name="parameters[show_attributes][1]"]
1616
</selector>
1717
<input>multiselect</input>
1818
</show_attributes>
1919
<show_buttons>
2020
<selector>
21-
.control [name="parameters[show_buttons][]"]
21+
.control [name="parameters[show_buttons][2]"]
2222
</selector>
2323
<input>multiselect</input>
2424
</show_buttons>

dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/Widget/Instance/Edit/Tab/ParametersType/RecentlyViewedProducts.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
</page_size>
1313
<show_attributes>
1414
<selector>
15-
.control [name="parameters[show_attributes][]"]
15+
.control [name="parameters[show_attributes][1]"]
1616
</selector>
1717
<input>multiselect</input>
1818
</show_attributes>
1919
<show_buttons>
2020
<selector>
21-
.control [name="parameters[show_buttons][]"]
21+
.control [name="parameters[show_buttons][2]"]
2222
</selector>
2323
<input>multiselect</input>
2424
</show_buttons>

dev/tests/functional/tests/app/Magento/Widget/Test/Block/Adminhtml/WidgetForm.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@
3232
<page_size />
3333
<show_attributes>
3434
<selector>
35-
.control [name="parameters[show_attributes][]"]
35+
.control [name="parameters[show_attributes][1]"]
3636
</selector>
3737
<input>multiselect</input>
3838
</show_attributes>
3939
<show_buttons>
4040
<selector>
41-
.control [name="parameters[show_buttons][]"]
41+
.control [name="parameters[show_buttons][2]"]
4242
</selector>
4343
<input>multiselect</input>
4444
</show_buttons>

lib/web/mage/validation.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1949,13 +1949,14 @@
19491949
* Before submitting the actual form, remove the previously assigned indices
19501950
* @param {Object} form
19511951
*/
1952-
this.options.submitHandler = function (form, event) {
1952+
this.options.submitHandler = function (form) {
19531953
originalElements.forEach(function (element) {
19541954
element.element.attr('name', element.name);
19551955
element.element.removeAttr('orig-name');
19561956
});
19571957

1958-
console.error(this.submit)
1958+
console.error(this.submit);
1959+
19591960
/* Call the originalSubmitHandler if it's a function */
19601961
typeof originalSubmitHandler === 'function' ? originalSubmitHandler(form) : form.submit();
19611962
};
@@ -1964,6 +1965,7 @@
19641965

19651966
/**
19661967
* Validation listening.
1968+
*
19671969
* @protected
19681970
*/
19691971
_listenFormValidate: function () {

0 commit comments

Comments
 (0)