diff --git a/lam/lib/html.inc b/lam/lib/html.inc index cdca4c0f..1c26f51d 100644 --- a/lam/lib/html.inc +++ b/lam/lib/html.inc @@ -675,6 +675,8 @@ class htmlSelect extends htmlElement { private $rightToLeftTextDirection = false; /** enabled or disabled */ private $isEnabled = true; + /** width of input element */ + private $width = ''; /** * Constructor. @@ -732,7 +734,11 @@ class htmlSelect extends htmlElement { if (!$this->isEnabled) { $disabled = ' disabled'; } - echo '\n"; + $style = ''; + if ($this->width != '') { + $style = ' style="width: ' . $this->width . '"'; + } + echo '\n"; $tabindex++; if ($this->containsOptgroups) { foreach ($this->elements as $label => $elements) { @@ -847,6 +853,15 @@ class htmlSelect extends htmlElement { $this->isEnabled = $isEnabled; } + /** + * Specifies the width of this selection box. + * + * @param String $width width (e.g. 20em) + */ + public function setWidth($width) { + $this->width = htmlspecialchars($width); + } + } /**