Skip to content

Commit 1b3d488

Browse files
committed
Flash form success state when calling done()
1 parent 10d4349 commit 1b3d488

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/Form.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515

1616
class Form extends BaseForm
1717
{
18+
/**
19+
* Session key for the success state.
20+
*
21+
* @var string
22+
*/
23+
const FLASH_KEY_SUCCESS = 'form.success';
24+
1825
/**
1926
* Indicates whether the validation should still be done
2027
*
@@ -76,7 +83,7 @@ function __construct($rules = [], $sessionKey = null)
7683
$this->shouldRedirect = true;
7784
$this->shouldFlash = true;
7885
$this->shouldFallThrough = false;
79-
$this->success = false;
86+
$this->success = $this->flash->get(self::FLASH_KEY_SUCCESS, false);
8087
}
8188

8289
/**
@@ -207,6 +214,8 @@ public function action($action, $options = [])
207214
*/
208215
public function done()
209216
{
217+
$this->flash->set(self::FLASH_KEY_SUCCESS, $this->success);
218+
210219
if ($this->shouldRedirect) {
211220
die(Response::redirect(Url::last()));
212221
} else {

0 commit comments

Comments
 (0)