Using TYPO3 10 LTS, I have a contact form at https://example.com/contacts
I use the "Confirmation finisher" that has the same url https://example.com/contacts with some query string and post.
I needed another specific URL for when the form has been submitted successfully so I used this route enhancer:
routeEnhancers:
ContactForm:
type: Extbase
extension: Form
plugin: Formframework
routes:
- routePath: '/submit'
_controller: 'FormFrontend::perform'
defaultController: 'FormFrontend::perform'
Now the URL of a submitted form is: https://example.com/contacts/submit
The problem is that this URL appears even if the form has error (eg.: captcha error) so it's not really finished.
Is there a way to have a specific URL only when the form is submitted successfully?
You can use the Redirect
finisher in your form definition.
This will only be triggered upon successful submit and you will have a different URL in the end.
As bonus you also prevent re-submit by reload this way.