FormBuilder redirects
Created 6 years ago by girvydas

Hey, maybe anyone could suggest solution how to redirect to previous page after form save action. Ex.: Contacts module has Contacts and ContactPerson streams. Then user navigate from url: /admin/contacts/contacts/1/persons to /admin/contacts/persons/1 and "save&exit" it should return back to persons list, not contacts. Now it is returning back to main "section" which is set to be contacts. I've searched in code and found that there is RedirectGuesser responsible for that redirects… How I can globally change/achieve this? Create new actions? Set FormResponses? etc?

dominique  —  6 years ago

In your form builder you can populate the actions array.

For example:

     * The form actions.
     * @var array|string
    protected $actions = [
        'update' => [
            'enabled' => 'edit',
            'redirect' => 'admin/products/ratings/{request.route.parameters.subcategory_id}/edit/{}'
        'save_edit' => [
            'enabled' => 'edit',
            'redirect' => 'admin/products/ratings/{request.route.parameters.subcategory_id}'
        'save' => [
            'enabled' => 'create',
            'redirect' => 'admin/products/ratings/{request.route.parameters.subcategory_id}'
        'save_create' => [
            'enabled' => 'create'
girvydas  —  6 years ago

Hmm.. interesting idea, but maybe there is way to set more globally these settings? Something like dynamic guess where to redirect back?