diff --git a/form.php b/form.php index 2178bc0..653d407 100644 --- a/form.php +++ b/form.php @@ -315,19 +315,29 @@ class formfield if (isset ($this->readonly) && $this->readonly !== FALSE) $res .= " disabled='disabled'"; // Do not check by default ! - // Check is enable if not null, false, 'unset' or '' + // Check is enable if not null and not false and not "unset" and not "" if (count ($this->titles) === 1) { - if (isset ($this->values) && $this->values !== "unset") + if (isset ($this->values) && + $this->values !== null && + $this->values !== false && + $this->values !== "unset" && + $this->values !== "") $res .= " checked='checked'"; - elseif (count ($this->titles) === 1 && isset ($this->defaults) && - $this->defaults !== null && $this->defaults !== false && - $this->defaults !== "unset" && $this->defaults !== "") + elseif (isset ($this->defaults) && + $this->defaults !== null && + $this->defaults !== false && + $this->defaults !== "unset" && + $this->defaults !== "") $res .= " checked='checked'"; } else { - if (isset ($this->values[$key]) && $this->values[$key] !== "unset") + 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 &&