mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
abbee41b78
commit
729bcc95db
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user