diff --git a/forms/Form.php b/forms/Form.php index 258b82ba3..8764d84d5 100644 --- a/forms/Form.php +++ b/forms/Form.php @@ -974,9 +974,7 @@ class Form extends RequestHandler { */ public function Message() { $this->getMessageFromSession(); - $message = $this->message; - $this->clearMessage(); - return $message; + return $this->message; } /** @@ -993,8 +991,6 @@ class Form extends RequestHandler { }else{ $this->message = Session::get("FormInfo.{$this->FormName()}.formError.message"); $this->messageType = Session::get("FormInfo.{$this->FormName()}.formError.type"); - - Session::clear("FormInfo.{$this->FormName()}"); } } @@ -1030,9 +1026,11 @@ class Form extends RequestHandler { $this->message = null; Session::clear("FormInfo.{$this->FormName()}.errors"); Session::clear("FormInfo.{$this->FormName()}.formError"); + Session::clear("FormInfo.{$this->FormName()}.data"); } public function resetValidation() { Session::clear("FormInfo.{$this->FormName()}.errors"); + Session::clear("FormInfo.{$this->FormName()}.data"); } /** @@ -1317,6 +1315,13 @@ class Form extends RequestHandler { (array)$this->getTemplate(), array('Form') )); + + // Now that we're rendered, clear message + Session::clear("FormInfo.{$this->FormName()}.errors"); + Session::clear("FormInfo.{$this->FormName()}.formError"); + Session::clear("FormInfo.{$this->FormName()}.data"); + + return $result; } /**