diff --git a/.gitignore b/.gitignore index b656f0851..affc88c5c 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,5 @@ local/* include/tfpdf/font/unifont/* html/ads.html doc/code/* +nbproject/private/ + diff --git a/include/lib/itext.class.php b/include/lib/itext.class.php index 647c7392b..783ae93f2 100644 --- a/include/lib/itext.class.php +++ b/include/lib/itext.class.php @@ -32,7 +32,8 @@ class IText extends HtmlInput var $title; var $autofocus; var $css_size; - + var $pattern; /*!< $pattern HTML pattern */ + var $maxlength; /*!< HTML maxlength */ function __construct($name='',$value='',$p_id="") { parent::__construct($name,$value,$p_id); @@ -43,6 +44,8 @@ class IText extends HtmlInput $this->autofocus=false; $this->require=false; $this->css_size=""; + $this->pattern=""; + $this->maxlength=""; } /*! \brief show the html input of the widget @@ -62,11 +65,24 @@ class IText extends HtmlInput $t= 'title="'.$this->title.'" '; $autofocus=($this->autofocus)?" autofocus ":""; $require=($this->require)?"required":""; + + // var $pattern regex to match the INPUT TEXT + $pattern=""; + if ($this->pattern != "") { + $pattern= sprintf( 'pattern="%s"',$this->pattern); + } + + // var maxlength HTML attribute + $maxlength = ""; + if ($this->maxlength !="" ) { + $maxlength=sprintf(' maxlength="%s" ',$this->maxlength); + } + if ( ! isset ($this->css_size) || empty ($this->css_size)) { $r= sprintf(' + style="width:%s;" %s %s %s %s %s %s %s> ',$this->style, $this->id, $this->name, @@ -78,7 +94,9 @@ class IText extends HtmlInput $this->extra, $autofocus, $require, - $strAttribute + $strAttribute, + $pattern, + $maxlength ); } else { $r= sprintf('extra, $autofocus, $require, - $strAttribute + $strAttribute, + $pattern, + $maxlength ); } @@ -110,7 +130,8 @@ class IText extends HtmlInput $t= ((isset($this->title)))?'title="'.$this->title.'" ':' '; $extra=(isset($this->extra))?$this->extra:""; - + $strAttribute=$this->get_node_attribute(); + $readonly=" readonly "; $this->value=htmlentities($this->value??"", ENT_COMPAT|ENT_QUOTES, "UTF-8"); $this->style=' class="input_text_ro" '; @@ -119,16 +140,18 @@ class IText extends HtmlInput $r='style.' TYPE="TEXT" id="'. $this->id.'"'.$t. 'NAME="'.$this->name.'" VALUE="'.$this->value.'" '. - 'SIZE="'.$this->size.'" '.$this->javascript." $readonly $this->extra >"; + 'SIZE="'.$this->size.'" '.$this->javascript." $readonly $this->extra $strAttribute>"; } else { $r='style.' TYPE="TEXT" id="'. $this->id.'"'.$t. 'NAME="'.$this->name.'" VALUE="'.$this->value.'" '. - ' style="width:'.$this->css_size.'" '.$this->javascript." $readonly $this->extra >"; + ' style="width:'.$this->css_size.'" '.$this->javascript." $readonly $this->extra $strAttribute>"; } /* add tag for column if inside a table */ - if ( $this->table == 1 ) $r='
+ $itext=new IText("itext_name");
+ $itext->set_attribute("key1",1);
+ $itext->set_attribute("data1","-data-");
+ $itext->set_attribute("logx","data:logx");
+ echo $itext->input();
+ echo $itext->display();
+
+style=' class="input_text" ';
+ $itext->set_attribute("key1",1);
+ $itext->set_attribute("data1","-data-");
+ $itext->set_attribute("logx","data:logx");
+ echo $itext->input();
+ echo $itext->display();
+?>
++ = htmlspecialchars($itext->input());?> + = htmlspecialchars($itext->display());?> ++
+ = htmlspecialchars($itext->input());?> + = htmlspecialchars($itext->display());?> ++
+ $itext->placeholder="Donnez une information"; + = htmlspecialchars($itext->input());?> + = htmlspecialchars($itext->display());?> ++
+ $itext->require=true; + = htmlspecialchars($itext->input());?> + = htmlspecialchars($itext->display());?> ++