Why would the route not match the controller? Like, the form is submitting to the controller for the page that the form is on? If so, it’s just that you haven’t set up the form correctly.
display ApplicationsController.php on the route /contact”? That’s just a matter of setting up your routes, nothing magical here.
Maybe you need to clarify what you’re trying to do, what you’ve tried to accomplish that, and what’s not working about your efforts.
The point of what I want to do is that I set that I want to display the form on several pages, so the routes can be
/contact /applications /support/form
and there is one in the controller, if I make a post to /ApplicationController.php, how can I then render the error messages, without redirecting, or can I redirect, won’t my flash message disappear? I want to render what is wrong in the form… just like it is done for the classic form and controller.
Let’s assume that the form is like a newsletter signup. My usual solution for something like this would be:
Have the cell create the form to target the newsletter signup controller action, not the page that the form is on.
Include a hidden field with the URL of the page you’ve come from.
If there are validation or other issues, deal with them on a newsletter signup specific page, don’t make any attempt to integrate that into the page the form was submitted from.
If the signup is successful, redirect them back to the URL from the hidden form field.
Alternately, do the entire form submission and validation and all that via Ajax, and never leave the original page.