Skip to content

Commit 4fc6f02

Browse files
author
Oleksii Korshenko
authored
MAGETWO-81467: Bug fix update attributes #11349
2 parents 7cd2d86 + f2b73fb commit 4fc6f02

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/internal/Magento/Framework/Data/Form/Element/Multiselect.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ public function getElementHtml()
5757
$this->addClass('select multiselect admin__control-multiselect');
5858
$html = '';
5959
if ($this->getCanBeEmpty()) {
60-
$html .= '<input type="hidden" name="' . parent::getName() . '" value="" />';
60+
$html .= '
61+
<input type="hidden" id="' . $this->getHtmlId() . '_hidden" name="' . parent::getName() . '" value="" />
62+
';
6163
}
6264
if (!empty($this->_data['disabled'])) {
6365
$html .= '<input type="hidden" name="' . parent::getName() . '_disabled" value="" />';

lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/MultiselectTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,15 @@ protected function setUp()
2727
public function testHiddenFieldPresentInMultiSelect()
2828
{
2929
$fieldName = 'fieldName';
30+
$fieldId = 'fieldId';
3031
$this->_model->setCanBeEmpty(true);
3132
$this->_model->setName($fieldName);
33+
$this->_model->setId($fieldId);
3234
$elementHtml = $this->_model->getElementHtml();
33-
$this->assertContains('<input type="hidden" name="' . $fieldName . '"', $elementHtml);
35+
$this->assertContains(
36+
'<input type="hidden" id="' . $fieldId . '_hidden" name="' . $fieldName . '"',
37+
$elementHtml
38+
);
3439
}
3540

3641
/**

0 commit comments

Comments
 (0)