I've got a form in Statamic, and I want to pass some data back to it on submission to show a nice 'All good' message, e.g:
return redirect()
->back()
->with(['form_success' => true]);
Unfortunately the template completely ignores the contents of ->with() in the template.
Is there a way to get it to listen to with, or is there another way of doing this?
Whenever you return like that from a
POST
route, I believe thewith
data is also available in the session.So in Antlers, you should be able to do something like this:
And to display something in your template depending on if
form_success
is available, you can do this:Hopefully this will work for you!