diff includes/form.inc @ 11:589fb7c02327 6.5

Drupal 6.5
author Franck Deroche <webmaster@defr.org>
date Tue, 23 Dec 2008 14:32:19 +0100
parents acef7ccb09b5
children 8b6c45761e01
line wrap: on
line diff
--- a/includes/form.inc	Tue Dec 23 14:32:08 2008 +0100
+++ b/includes/form.inc	Tue Dec 23 14:32:19 2008 +0100
@@ -1,5 +1,5 @@
 <?php
-// $Id: form.inc,v 1.265.2.10 2008/08/13 23:59:12 drumm Exp $
+// $Id: form.inc,v 1.265.2.12 2008/09/23 10:51:16 goba Exp $
 
 /**
  * @defgroup forms Form builder functions
@@ -782,12 +782,17 @@
  *   element where the #parents array starts with 'foo'.
  * @param $message
  *   The error message to present to the user.
+ * @param $reset
+ *   Reset the form errors static cache.
  * @return
  *   Never use the return value of this function, use form_get_errors and
  *   form_get_error instead.
  */
-function form_set_error($name = NULL, $message = '') {
+function form_set_error($name = NULL, $message = '', $reset = FALSE) {
   static $form = array();
+  if ($reset) {
+    $form = array();
+  }
   if (isset($name) && !isset($form[$name])) {
     $form[$name] = $message;
     if ($message) {
@@ -934,7 +939,7 @@
 
   // If some callback set #cache, we need to flip a static flag so later it
   // can be found.
-  if (isset($form['#cache'])) {
+  if (!empty($form['#cache'])) {
     $cache = $form['#cache'];
   }
   // We are on the top form, we can copy back #cache if it's set.