form : manage correctely the form focus if the first field is a checkbox
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@6034 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
16
form.php
16
form.php
@@ -782,7 +782,9 @@ class formfield
|
|||||||
// No $this->multiple, $this->rows $this->cols $this->placeholder,
|
// No $this->multiple, $this->rows $this->cols $this->placeholder,
|
||||||
// $this->maxlength
|
// $this->maxlength
|
||||||
if (! is_array ($this->titles) || count ($this->titles) === 0)
|
if (! is_array ($this->titles) || count ($this->titles) === 0)
|
||||||
$this->titles = array ("");
|
$titles = array ("");
|
||||||
|
else
|
||||||
|
$titles = $this->titles;
|
||||||
$res = "";
|
$res = "";
|
||||||
$res .= "<div class='form-group";
|
$res .= "<div class='form-group";
|
||||||
if (isset ($this->errors))
|
if (isset ($this->errors))
|
||||||
@@ -812,36 +814,36 @@ class formfield
|
|||||||
$res .= "</label>\n";
|
$res .= "</label>\n";
|
||||||
}
|
}
|
||||||
$res .= " <div class='col-sm-$this->fieldwidth'>\n";
|
$res .= " <div class='col-sm-$this->fieldwidth'>\n";
|
||||||
foreach ($this->titles as $key=>$val)
|
foreach ($titles as $key=>$val)
|
||||||
{
|
{
|
||||||
$res .= " <div class='checkbox'>\n";
|
$res .= " <div class='checkbox'>\n";
|
||||||
$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)."]";
|
||||||
if (count ($this->titles) > 1)
|
if (count ($titles) > 1)
|
||||||
$res .= "[$key]";
|
$res .= "[$key]";
|
||||||
$res .= "' value='unset'";
|
$res .= "' value='unset'";
|
||||||
$res .= "/>";
|
$res .= "/>";
|
||||||
$res .= "<label for='$this->formName"."_";
|
$res .= "<label for='$this->formName"."_";
|
||||||
$res .= htmlspecialchars ($this->name, ENT_QUOTES);
|
$res .= htmlspecialchars ($this->name, ENT_QUOTES);
|
||||||
if (count ($this->titles) > 1)
|
if (count ($titles) > 1)
|
||||||
$res .= "_$key";
|
$res .= "_$key";
|
||||||
$res .= "'>";
|
$res .= "'>";
|
||||||
$res .= "<input type='checkbox'";
|
$res .= "<input type='checkbox'";
|
||||||
$res .= " name='$this->formName"."[";
|
$res .= " name='$this->formName"."[";
|
||||||
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."]";
|
$res .= htmlspecialchars ($this->name, ENT_QUOTES)."]";
|
||||||
if (count ($this->titles) > 1)
|
if (count ($titles) > 1)
|
||||||
$res .= "[$key]";
|
$res .= "[$key]";
|
||||||
$res .= "' id='$this->formName"."_";
|
$res .= "' id='$this->formName"."_";
|
||||||
$res .= htmlspecialchars ($this->name, ENT_QUOTES);
|
$res .= htmlspecialchars ($this->name, ENT_QUOTES);
|
||||||
if (count ($this->titles) > 1)
|
if (count ($titles) > 1)
|
||||||
$res .= "_$key";
|
$res .= "_$key";
|
||||||
$res .= "'";
|
$res .= "'";
|
||||||
if (isset ($this->readonly) && $this->readonly !== FALSE)
|
if (isset ($this->readonly) && $this->readonly !== FALSE)
|
||||||
$res .= " disabled='disabled'";
|
$res .= " disabled='disabled'";
|
||||||
// Do not check by default !
|
// Do not check by default !
|
||||||
// Check is enable if not null and not false and not "unset" and not ""
|
// Check is enable if not null and not false and not "unset" and not ""
|
||||||
if (count ($this->titles) === 1)
|
if (count ($titles) === 1)
|
||||||
{
|
{
|
||||||
if (isset ($this->values) &&
|
if (isset ($this->values) &&
|
||||||
$this->values !== null &&
|
$this->values !== null &&
|
||||||
|
|||||||
Reference in New Issue
Block a user