diff --git a/include/lib/itext.class.php b/include/lib/itext.class.php index b0fb54394..5f7ce2d0c 100644 --- a/include/lib/itext.class.php +++ b/include/lib/itext.class.php @@ -44,6 +44,9 @@ class IText extends HtmlInput var $pattern; /*!< $pattern HTML pattern */ var $maxlength; /*!< HTML maxlength */ var $require ; /*!< $require (bool)*/ + protected $datalist; /*!< $datalist (double array) + * each row has a key (value) and a label used with make_datalist */ + function __construct($name='',$value='',$p_id="") { parent::__construct($name,$value,$p_id); @@ -56,6 +59,7 @@ class IText extends HtmlInput $this->css_size=""; $this->pattern=""; $this->maxlength=""; + $this->datalist=null; } /*! \brief show the html input of the widget @@ -87,12 +91,12 @@ class IText extends HtmlInput if ($this->maxlength !="" ) { $maxlength=sprintf(' maxlength="%s" ',$this->maxlength); } - + $datalist=(empty($this->datalist ))?"":sprintf('list="dl_%s"',$this->id); if ( ! isset ($this->css_size) || empty ($this->css_size)) { $r= sprintf(' + size="%s" %s %s %s %s %s %s %s %s> ',$this->style, $this->id, $this->name, @@ -106,11 +110,12 @@ class IText extends HtmlInput $require, $strAttribute, $pattern, - $maxlength + $maxlength, + $datalist ); } else { $r= sprintf(' + style="width:%s ;" %s %s %s %s %s %s> ',$this->style, $this->id, $this->name, @@ -124,17 +129,27 @@ class IText extends HtmlInput $require, $strAttribute, $pattern, - $maxlength + $maxlength, + $datalist ); } /* add tag for column if inside a table */ if ( $this->table == 1 ) $r='