diff --git a/form.php b/form.php index 9f8729c..92cd86c 100644 --- a/form.php +++ b/form.php @@ -62,6 +62,7 @@ class form - [hidden] : hide the field (add a style='display:hidden' to the field) - [rows] : Number of rows - [cols] : Number of columns + - [placeholder] : The text to be displayed in the placeholder @param array $fields The fields to be displayed */ @@ -280,7 +281,7 @@ class formfield /** Return the checkbox defined */ public function fieldcheckbox () { - // No $this->multiple, $this->rows $this->cols + // No $this->multiple, $this->rows $this->cols $this->placeholder $res = ""; $res .= "
name, ENT_QUOTES)."]'"; @@ -448,6 +449,9 @@ class formfield $res .= " aria-describedby='".$this->formName."_"; $res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'"; } + if (isset ($this->placeholder) && $this->placeholder !== FALSE) + $res .= " placeholder='".htmlentities ($this->placeholder, ENT_QUOTES). + "'"; $res .= "/>\n"; if (isset ($this->errors) || isset ($this->help)) { @@ -467,7 +471,7 @@ class formfield public function fieldradio () { $res = ""; - // No $this->multiple, $this->rows $this->cols + // No $this->multiple, $this->rows $this->cols $this->placeholder $res .= "
label, $this->multiple, $this->error, $this->rows, - // $this->cols + // $this->cols $this->placeholder $res .= "
\n"; $res .= "
\n"; @@ -717,6 +722,9 @@ class formfield $res .= " aria-describedby='".$this->formName."_"; $res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'"; } + if (isset ($this->placeholder) && $this->placeholder !== FALSE) + $res .= " placeholder='".htmlentities ($this->placeholder, ENT_QUOTES). + "'"; $res .= ">"; if (isset ($this->values)) $res .= htmlspecialchars ($this->values, ENT_QUOTES); @@ -782,6 +790,9 @@ class formfield $res .= " aria-describedby='".$this->formName."_"; $res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'"; } + if (isset ($this->placeholder) && $this->placeholder !== FALSE) + $res .= " placeholder='".htmlentities ($this->placeholder, ENT_QUOTES). + "'"; $res .= "/>\n"; if (isset ($this->errors) || isset ($this->help)) {