BUGFIX: Don't clear form messages unless forTemplate() is actually called.

BUGFIX: Clear session-stored form data as well as form error message.
This commit is contained in:
Sam Minnee 2011-08-31 18:19:20 +12:00
parent abbee41b78
commit 729bcc95db

View File

@ -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;
}
/**