From 2a7341832a8048a895e3c65469bb3922e49b34e5 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Fri, 30 Sep 2016 13:49:24 +0000 Subject: [PATCH] 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 --- form.php | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/form.php b/form.php index 7118a87..80db50f 100644 --- a/form.php +++ b/form.php @@ -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'";