Enable refresh on form controller requests (correct branch)

This adds support for a redirect to the current page (a refresh) to be returned by the form controller. An example use case is adding `data-request-data="refresh:1"` to the save button on an update form. I'm using it for an update form that disables certain fields (including a relationRender partial) based on values submitted on that page. Refreshing the view after saving allows my disabling rules to take effect.
This commit is contained in:
Luke Towers 2016-07-27 09:05:12 -06:00 committed by GitHub
parent c0f14b33a7
commit b26eeed03c
1 changed files with 4 additions and 0 deletions

View File

@ -389,6 +389,10 @@ class FormController extends ControllerBehavior
if (post('close') && !ends_with($context, '-close')) {
$context .= '-close';
}
if (post('refresh', false)) {
return Redirect::refresh();
}
if (post('redirect', true)) {
$redirectUrl = $this->getRedirectUrl($context);