fix for select with empty value
This commit is contained in:
parent
fab16750a6
commit
e6dd937f32
|
@ -1273,13 +1273,13 @@ class htmlSelect extends htmlElement {
|
||||||
foreach ($elements as $key => $value) {
|
foreach ($elements as $key => $value) {
|
||||||
$selected = '';
|
$selected = '';
|
||||||
if ($this->hasDescriptiveElements) {
|
if ($this->hasDescriptiveElements) {
|
||||||
if (in_array($value, $this->selectedElements)) {
|
if (in_array($value, $this->selectedElements) || (empty($this->selectedElements) && empty($value))) {
|
||||||
$selected = ' selected';
|
$selected = ' selected';
|
||||||
}
|
}
|
||||||
echo "<option value=\"" . htmlspecialchars($value) . "\"$selected>" . htmlspecialchars($key) . "</option>\n";
|
echo "<option value=\"" . htmlspecialchars($value) . "\"$selected>" . htmlspecialchars($key) . "</option>\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (in_array($value, $this->selectedElements)) {
|
if (in_array($value, $this->selectedElements) || (empty($this->selectedElements) && empty($value))) {
|
||||||
$selected = ' selected';
|
$selected = ' selected';
|
||||||
}
|
}
|
||||||
echo "<option$selected>" . htmlspecialchars($value) . "</option>\n";
|
echo "<option$selected>" . htmlspecialchars($value) . "</option>\n";
|
||||||
|
|
Loading…
Reference in New Issue