Skip to content

Commit fc6ffa8

Browse files
author
WEXO
authored
Change value-assignment to a setValue call
Is there any reasons not to use Prototype's setValue call instead of assignment? Plain assignment breaks in case of a multiselect element. In case of multiselect, and an array in rowData.column_values[rowInputElementNames[i]] the first element of that array will be taken and assigned as the only selected value on a multiselect, which is clearly a broken behaviour. Prototype's setValue call will handle this case properly without breaking compatibility.
1 parent 3561b66 commit fc6ffa8

File tree

1 file changed

+1
-1
lines changed
  • app/code/Magento/Config/view/adminhtml/templates/system/config/form/field

1 file changed

+1
-1
lines changed

Diff for: app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ $_colspan = $block->isAddAfter() ? 2 : 1;
9393
var rowInputElementNames = Object.keys(rowData.column_values);
9494
for (var i = 0; i < rowInputElementNames.length; i++) {
9595
if ($(rowInputElementNames[i])) {
96-
$(rowInputElementNames[i]).value = rowData.column_values[rowInputElementNames[i]];
96+
$(rowInputElementNames[i]).setValue(rowData.column_values[rowInputElementNames[i]]);
9797
}
9898
}
9999
}

0 commit comments

Comments
 (0)