From b57b6339445e36509d4a5abea9e3c9760bbdb34c Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 19 Aug 2011 06:21:46 +0000 Subject: [PATCH] ability to unset validation messages --- etemplate/inc/class.etemplate.inc.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/etemplate/inc/class.etemplate.inc.php b/etemplate/inc/class.etemplate.inc.php index 9b06cfdc3d..15296ad9bc 100644 --- a/etemplate/inc/class.etemplate.inc.php +++ b/etemplate/inc/class.etemplate.inc.php @@ -2384,7 +2384,7 @@ class etemplate extends boetemplate * Sets a validation error, to be displayed in the next exec * * @param string $name (complete) name of the widget causing the error - * @param string $error error-message already translated + * @param string|boolean $error error-message already translated or false to reset all existing error for given name * @param string $cname=null set it to '', if the name is already a form-name, defaults to self::$name_vars */ static function set_validation_error($name,$error,$cname=null) @@ -2393,11 +2393,18 @@ class etemplate extends boetemplate //echo "

etemplate::set_validation_error('$name','$error','$cname');

\n"; if ($cname) $name = self::form_name($cname,$name); - if (self::$validation_errors[$name]) + if ($error === false) { - self::$validation_errors[$name] .= ', '; + unset(self::$validation_errors[$name]); + } + else + { + if (self::$validation_errors[$name]) + { + self::$validation_errors[$name] .= ', '; + } + self::$validation_errors[$name] .= $error; } - self::$validation_errors[$name] .= $error; } /**