setOptions and setFormOptions has no effect on redirect

lckamal - 3 months ago

I have set redirect option on form builder to redirect in different place for different action but it doesn't seems to work.

if($entry->live && $this->getFormMode() == 'create'){
            $this->setFormOption('redirect', '/employer/job-post-success');
            $this->setOption('redirect', '/employer/job-post-success');
        }else{
            $this->setFormOption('redirect', '/employer/dashboard');
            $this->setOption('redirect', '/employer/dashboard');
        }

ryanthompson - 3 months ago

When are you doing this in the lifecycle of the form? You may need to set the response manually if it's too late in the cycle.

$this->setFormResponse($redirect->to('example'));