Skip to content

Commit

Permalink
⏫ Forwardport of #11349 to 2.3-develop branch
Browse files Browse the repository at this point in the history
  • Loading branch information
p-bystritsky committed Jan 24, 2018
1 parent 8e77e2f commit b322c09
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ public function getElementHtml()
$this->addClass('select multiselect admin__control-multiselect');
$html = '';
if ($this->getCanBeEmpty()) {
$html .= '<input type="hidden" name="' . parent::getName() . '" value="" />';
$html .= '
<input type="hidden" id="' . $this->getHtmlId() . '_hidden" name="' . parent::getName() . '" value="" />
';
}
$html .= '<select id="' . $this->getHtmlId() . '" name="' . $this->getName() . '" ' . $this->serialize(
$this->getHtmlAttributes()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,16 @@ protected function setUp()
*/
public function testHiddenFieldPresentInMultiSelect()
{
$this->_model->setDisabled(true);
$fieldName = 'fieldName';
$fieldId = 'fieldId';
$this->_model->setCanBeEmpty(true);
$this->_model->setName($fieldName);
$this->_model->setId($fieldId);
$elementHtml = $this->_model->getElementHtml();
$this->assertContains('<input type="hidden"', $elementHtml);
$this->assertContains(
'<input type="hidden" id="' . $fieldId . '_hidden" name="' . $fieldName . '"',
$elementHtml
);
}

/**
Expand Down

0 comments on commit b322c09

Please sign in to comment.