function gui_textbox($elemname, $currentvalue = '', $prompttext = '', $helptext = '', $jsvalidation = '', $failvalidationmsg = '', $canbeempty = true, $maxchars = 0, $disable = false) { // call parent class contructor parent::__construct($elemname, $currentvalue, $prompttext, $helptext, $jsvalidation, $failvalidationmsg, $canbeempty); $maxlength = $maxchars > 0 ? " maxlength=\"{$maxchars}\"" : ''; $tabindex = guielement::gettabindex(); $disable_state = $disable ? 'disabled="true"' : ''; $this->html_input = "<input type=\"text\" name=\"{$this->_elemname}\" id=\"{$this->_elemname}\" size=\"35\" {$disable_state} {$maxlength} tabindex=\"{$tabindex}\" value=\"" . htmlspecialchars($this->currentvalue) . "\">"; }
public function __construct($elemname, $currentvalue = '', $prompttext = '', $helptext = '', $jsvalidation = '', $failvalidationmsg = '', $canbeempty = true, $maxchars = 0, $class = '', $select = array()) { if (is_array($elemname)) { extract($elemname); } parent::__construct($elemname, $currentvalue, $prompttext, $helptext, $jsvalidation, $failvalidationmsg, $canbeempty); $maxlength = $maxchars > 0 ? " maxlength=\"{$maxchars}\"" : ''; $disable_state = isset($disable) && $disable ? ' disabled' : ''; $list = explode("\n", $this->currentvalue); $rows = count($list); $rows = $rows > 20 ? 20 : $rows; $rows++; $this->html_input = "<textarea rows=\"{$rows}\" name=\"{$this->_elemname}\" class=\"form-control autosize " . $class . "\" id=\"{$this->_elemname}\" {$maxlength} {$disable_state}>" . htmlentities($this->currentvalue) . "</textarea>"; $this->type = "textarea"; }