--- /tmp/drupal-5.1/includes/form.inc	2007-01-30 08:51:53.000000000 +1100
+++ includes/form.inc	2007-02-15 10:55:25.000000000 +1100
@@ -581,18 +582,36 @@ function _form_validate($elements, $form
 }
 
 /**
+ * Set the static variable to the array.
+ * This is nice because we can still have the static array, but it allows
+ * people who need to reset it, the ability to reset it
+ */
+function _form_set_error_array($array = null) {
+  static $form = array();
+
+  if (isset($array)) {
+    $form = $array;
+  }
+
+  return $form;
+}
+
+/**
  * File an error against a form element. If the name of the element is
  * edit[foo][bar] then you may pass either foo or foo][bar as $name
  * foo will set an error for all its children.
  */
 function form_set_error($name = NULL, $message = '') {
-  static $form = array();
+  $form = _form_set_error_array();
+
   if (isset($name) && !isset($form[$name])) {
     $form[$name] = $message;
     if ($message) {
       drupal_set_message($message, 'error');
     }
   }
+
+  $form = _form_set_error_array($form);
   return $form;
 }
 
@@ -600,7 +619,7 @@ function form_set_error($name = NULL, $m
  * Return an associative array of all errors.
  */
 function form_get_errors() {
-  $form = form_set_error();
+  $form = _form_set_error_array();
   if (!empty($form)) {
     return $form;
   }
@@ -610,7 +629,7 @@ function form_get_errors() {
  * Return the error message filed against the form with the specified name.
  */
 function form_get_error($element) {
-  $form = form_set_error();
+  $form = _form_set_error_array();
   $key = $element['#parents'][0];
   if (isset($form[$key])) {
     return $form[$key];
@@ -622,6 +641,13 @@ function form_get_error($element) {
 }
 
 /**
+ * Resets the errors for this form.
+ */
+function form_reset_errors() {
+  _form_set_error_array(array());
+}
+
+/**
  * Flag an element as having an error.
  */
 function form_error(&$element, $message = '') {
