fixed closing div on empty select

This commit is contained in:
Roland Gruber 2019-08-15 17:01:53 +02:00
parent 8df75742d2
commit 1d994cc5b8
1 changed files with 10 additions and 11 deletions

View File

@ -1320,19 +1320,18 @@ class htmlSelect extends htmlElement {
} }
echo "</select>\n"; echo "</select>\n";
// if select box has only one element then show it as text // if select box has only one element then show it as text
if ((sizeof($this->elements) == 1) && !$this->multiSelect && $this->transformSingleSelect) { if ((sizeof($this->elements) < 2) && !$this->multiSelect && $this->transformSingleSelect) {
echo '</div>'; echo '</div>';
echo '&nbsp;'; if (sizeof($this->elements) == 1) {
if ($this->hasDescriptiveElements) { echo '&nbsp;';
$keys = array_keys($this->elements); if ($this->hasDescriptiveElements) {
echo $keys[0]; $keys = array_keys($this->elements);
echo $keys[0];
}
else {
echo $this->elements[0];
}
} }
else {
echo $this->elements[0];
}
}
elseif (sizeof($this->elements) == 0) {
echo '</div>';
} }
if ($this->transient) { if ($this->transient) {
return array(); return array();