diff --git a/main/inc/lib/pear/HTML/QuickForm/select.php b/main/inc/lib/pear/HTML/QuickForm/select.php index aa08d1b35c..aebab54bbc 100755 --- a/main/inc/lib/pear/HTML/QuickForm/select.php +++ b/main/inc/lib/pear/HTML/QuickForm/select.php @@ -367,6 +367,11 @@ class HTML_QuickForm_select extends HTML_QuickForm_element $this->setSelected($values); } foreach ($arr as $key => $val) { + // Fix in order to use list of entities. + if (is_object($val)) { + $key = $val->getId(); + $val = $val->__toString(); + } // Warning: new API since release 2.3 $this->addOption($val, $key); } @@ -524,12 +529,14 @@ class HTML_QuickForm_select extends HTML_QuickForm_element $strHtml .= $tabs . '\n"; $strValues = is_array($this->_values)? array_map('strval', $this->_values): array(); + foreach ($this->_options as $option) { + if (!empty($strValues) && in_array($option['attr']['value'], $strValues, true)) { $option['attr']['selected'] = 'selected'; } - $strHtml .= $tabs . "\t_getAttrString($option['attr']) . '>' . - $option['text'] . "\n"; + $strHtml .= $tabs . "_getAttrString($option['attr']) . '>' . + $option['text'] . ""; } foreach ($this->_optgroups as $optgroup) { $strHtml .= $tabs . "";