form : add the placeholder support
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2387 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
19
form.php
19
form.php
@@ -62,6 +62,7 @@ class form
|
|||||||
- [hidden] : hide the field (add a style='display:hidden' to the field)
|
- [hidden] : hide the field (add a style='display:hidden' to the field)
|
||||||
- [rows] : Number of rows
|
- [rows] : Number of rows
|
||||||
- [cols] : Number of columns
|
- [cols] : Number of columns
|
||||||
|
- [placeholder] : The text to be displayed in the placeholder
|
||||||
|
|
||||||
@param array $fields The fields to be displayed
|
@param array $fields The fields to be displayed
|
||||||
*/
|
*/
|
||||||
@@ -280,7 +281,7 @@ class formfield
|
|||||||
/** Return the checkbox defined */
|
/** Return the checkbox defined */
|
||||||
public function fieldcheckbox ()
|
public function fieldcheckbox ()
|
||||||
{
|
{
|
||||||
// No $this->multiple, $this->rows $this->cols
|
// No $this->multiple, $this->rows $this->cols $this->placeholder
|
||||||
$res = "";
|
$res = "";
|
||||||
$res .= "<div class='form-group";
|
$res .= "<div class='form-group";
|
||||||
if (isset ($this->errors))
|
if (isset ($this->errors))
|
||||||
@@ -389,7 +390,7 @@ class formfield
|
|||||||
{
|
{
|
||||||
$res = "";
|
$res = "";
|
||||||
// No $this->label, $this->multiple, $this->readonly, $this->hidden,
|
// No $this->label, $this->multiple, $this->readonly, $this->hidden,
|
||||||
// $this->rows $this->cols
|
// $this->rows $this->cols $this->placeholder
|
||||||
$res .= "<input type='hidden'";
|
$res .= "<input type='hidden'";
|
||||||
$res .= " name='$this->formName"."[";
|
$res .= " name='$this->formName"."[";
|
||||||
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."]'";
|
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."]'";
|
||||||
@@ -448,6 +449,9 @@ class formfield
|
|||||||
$res .= " aria-describedby='".$this->formName."_";
|
$res .= " aria-describedby='".$this->formName."_";
|
||||||
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'";
|
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'";
|
||||||
}
|
}
|
||||||
|
if (isset ($this->placeholder) && $this->placeholder !== FALSE)
|
||||||
|
$res .= " placeholder='".htmlentities ($this->placeholder, ENT_QUOTES).
|
||||||
|
"'";
|
||||||
$res .= "/>\n";
|
$res .= "/>\n";
|
||||||
if (isset ($this->errors) || isset ($this->help))
|
if (isset ($this->errors) || isset ($this->help))
|
||||||
{
|
{
|
||||||
@@ -467,7 +471,7 @@ class formfield
|
|||||||
public function fieldradio ()
|
public function fieldradio ()
|
||||||
{
|
{
|
||||||
$res = "";
|
$res = "";
|
||||||
// No $this->multiple, $this->rows $this->cols
|
// No $this->multiple, $this->rows $this->cols $this->placeholder
|
||||||
$res .= "<div class='form-group";
|
$res .= "<div class='form-group";
|
||||||
if (isset ($this->errors))
|
if (isset ($this->errors))
|
||||||
$res .= " has-".$this->errors[0];
|
$res .= " has-".$this->errors[0];
|
||||||
@@ -540,6 +544,7 @@ class formfield
|
|||||||
/** Return the checkbox defined */
|
/** Return the checkbox defined */
|
||||||
public function fieldselect ()
|
public function fieldselect ()
|
||||||
{
|
{
|
||||||
|
// No $this->placeholder
|
||||||
$res = "";
|
$res = "";
|
||||||
// $values->$this, $this->cols
|
// $values->$this, $this->cols
|
||||||
$res .= "<div class='form-group";
|
$res .= "<div class='form-group";
|
||||||
@@ -649,7 +654,7 @@ class formfield
|
|||||||
{
|
{
|
||||||
$res = "";
|
$res = "";
|
||||||
// No $this->label, $this->multiple, $this->error, $this->rows,
|
// No $this->label, $this->multiple, $this->error, $this->rows,
|
||||||
// $this->cols
|
// $this->cols $this->placeholder
|
||||||
$res .= "<div class='form-group'>\n";
|
$res .= "<div class='form-group'>\n";
|
||||||
$res .= " <div class='col-sm-".($this->titlewidth+$this->fieldswidth).
|
$res .= " <div class='col-sm-".($this->titlewidth+$this->fieldswidth).
|
||||||
"'>\n";
|
"'>\n";
|
||||||
@@ -717,6 +722,9 @@ class formfield
|
|||||||
$res .= " aria-describedby='".$this->formName."_";
|
$res .= " aria-describedby='".$this->formName."_";
|
||||||
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'";
|
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'";
|
||||||
}
|
}
|
||||||
|
if (isset ($this->placeholder) && $this->placeholder !== FALSE)
|
||||||
|
$res .= " placeholder='".htmlentities ($this->placeholder, ENT_QUOTES).
|
||||||
|
"'";
|
||||||
$res .= ">";
|
$res .= ">";
|
||||||
if (isset ($this->values))
|
if (isset ($this->values))
|
||||||
$res .= htmlspecialchars ($this->values, ENT_QUOTES);
|
$res .= htmlspecialchars ($this->values, ENT_QUOTES);
|
||||||
@@ -782,6 +790,9 @@ class formfield
|
|||||||
$res .= " aria-describedby='".$this->formName."_";
|
$res .= " aria-describedby='".$this->formName."_";
|
||||||
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'";
|
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."_help'";
|
||||||
}
|
}
|
||||||
|
if (isset ($this->placeholder) && $this->placeholder !== FALSE)
|
||||||
|
$res .= " placeholder='".htmlentities ($this->placeholder, ENT_QUOTES).
|
||||||
|
"'";
|
||||||
$res .= "/>\n";
|
$res .= "/>\n";
|
||||||
if (isset ($this->errors) || isset ($this->help))
|
if (isset ($this->errors) || isset ($this->help))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user