form : manage correctely the checkboxes with values (the values can be defined and set to no "unset")

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3106 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2016-09-30 13:49:24 +00:00
parent 2ea05e91ca
commit 2a7341832a

View File

@@ -477,18 +477,22 @@ class formfield
}
else
{
if (isset ($this->values[$key]) &&
$this->values[$key] !== null &&
$this->values[$key] !== false &&
$this->values[$key] !== "unset" &&
$this->values[$key] !== "")
$res .= " checked='checked'";
elseif (isset ($this->defaults[$key]) &&
$this->defaults[$key] !== null &&
$this->defaults[$key] !== false &&
$this->defaults[$key] !== "unset" &&
$this->defaults[$key] !== "")
$res .= " checked='checked'";
if (isset ($this->values[$key]))
{
if ($this->values[$key] !== null &&
$this->values[$key] !== false &&
$this->values[$key] !== "unset" &&
$this->values[$key] !== "")
$res .= " Checked='checked'";
}
elseif (isset ($this->defaults[$key]))
{
if ($this->defaults[$key] !== null &&
$this->defaults[$key] !== false &&
$this->defaults[$key] !== "unset" &&
$this->defaults[$key] !== "")
$res .= " cheked='checked'";
}
}
if (isset ($this->hidden) && $this->hidden !== FALSE)
$res .= " style='display:none'";