form : the overwriting of hidden and read-only fields is done on values !

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3037 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2016-09-19 14:30:16 +00:00
parent 821fc9ed84
commit 01c1556672

View File

@@ -127,7 +127,7 @@ class form
foreach ($_SESSION["domframework"]["form"]["fields"] as $field)
{
if ($field->type === "hidden" || $field->readonly !== null)
$values[$field->name] = $field->defaults;
$values[$field->name] = $field->values;
}
}
@@ -148,6 +148,8 @@ class form
{
if (count ($this->fields) === 0)
throw new Exception ("Can't display a form without defined field", 500);
if (isset ($_SESSION))
$_SESSION["domframework"]["form"]["fields"] = $this->fields;
$this->method = strtolower ($method);
$res = "";
$res = "<form action='#' method='$method'";
@@ -225,8 +227,6 @@ class form
$res .= "<script>document.getElementById('".$this->formName."_".
$focusElement."').focus();</script>\n";
$res .= "</form>\n";
if (isset ($_SESSION))
$_SESSION["domframework"]["form"]["fields"] = $this->fields;
return $res;
}