From 5ad792d251be60f5cce569f0a17ffa4aafb1ca85 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Fri, 15 Apr 2016 15:08:27 +0000 Subject: [PATCH] form : if the provided error for a field is not an array, use the default error class and use the value as message git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2698 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- form.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/form.php b/form.php index fadb0d8..b7c459a 100644 --- a/form.php +++ b/form.php @@ -182,7 +182,12 @@ class form $field->values = $values[$field->name]; if (isset ($errors[$field->name]) && $errors[$field->name] !== "unset") - $field->errors = $errors[$field->name]; + { + if (is_array ($errors[$field->name])) + $field->errors = $errors[$field->name]; + else + $field->errors = array ("error", $errors[$field->name]); + } $field->titlewidth = $this->titlewidth; $field->fieldwidth = $this->fieldwidth; $res .= $field->display ();