Reputation: 2243
I have an Extbase extension which renders the form in the frontend and my URL is as below:
I need a static route for the submit action. I have added below YAML configuration.
routeEnhancers:
NewsFormPlugin:
type: Extbase
extension: NetcNewsform
plugin: netcnewsform
routes:
- { routePath: '/new-article/success', _controller: 'News::create'}
defaultController: 'News::new'
requirements:
page: '\d+'
This shows perfect static route in the form action, but while I submit the form this won't show the same URL in the browser.
Can anyone guide me? Big thanks!
Upvotes: 2
Views: 605
Reputation: 2243
I have fixed the issue, I had made a minor mistake which causes the issue. My action redirects to the New action of the controller and I had passed the wrong action at the YAML configuration.
routeEnhancers:
NewsFormPlugin:
type: Extbase
extension: NetcNewsform
plugin: netcnewsform
routes:
- { routePath: '/new-article/success', _controller: 'News::create'} # Here is the issue
defaultController: 'News::new'
requirements:
page: '\d+'
Instead of the above configuration, I used the below configuration.
NewsFormPlugin:
type: Extbase
extension: NetcNewsform
plugin: netcnewsform
routes:
- { routePath: '/new-article/success', _controller: 'News::create'}
- { routePath: '/new-article/success', _controller: 'News::new'}
defaultController: 'News::new'
requirements:
page: '\d+'
One more thing, I have added routes for create and new action both.
This working pretty well!
Upvotes: 2