Redirect finisher
This finisher redirects the user after submitting the form to a given page. Additional parameters can be added to the URL.
Table of contents
Important
Finishers are executed in the order defined in your form definition. This finisher stops the execution of all subsequent finishers in order to perform the redirect. Therefore, this finisher should always be the last finisher to be executed. Finishers after this one will never be executed.
Options of the redirect finisher
Page: [pageUid]
-
- Type
- int
- Required
true
- Default
1
ID of the page to redirect to. Button Page can be used to chose a page from the page tree.
Additional parameters: [additionalParameters]
-
- Type
- string
- Default
''
URL parameters which will be appended to the URL.
URL fragment: [fragment]
-
- Type
- string
- Default
''
ID of a content element identifier or a custom fragment identifier. This will be appended to the URL and used as section anchor.
Adds a fragment (e.g.
#c9
or#foo
) to the redirect link. The#
character can be omitted.
Additional options of the redirect finisher
These additional options can be set directly in the form definition YAML or programmatically in the options array but not from the backend editor:
delay
-
- Type
- int
- Default
0
The redirect delay in seconds.
statusCode
-
- Type
- int
- Default
303
The HTTP status code for the redirect. Default is "303 See Other".
Redirect finisher in the YAML form definition
Example: Load the redirect finisher last
identifier: contact
type: Form
prototypeName: standard
finishers:
-
identifier: EmailToSender
options:
subject: 'Your Message: {message}'
## ...
-
identifier: DeleteUploads
-
# Attention! The Redirect finisher stops the execution of all finishers
identifier: Redirect
options:
pageUid: 1
additionalParameters: 'param1=value1¶m2=value2'
Usage of the Redirect finisher in PHP code
Developers can create a confirmation finisher by using the key Redirect
:
<?php
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Form\Domain\Finishers\ClosureFinisher;
use TYPO3\CMS\Form\Domain\Model\FormDefinition;
class SomeClass
{
private function addRedirectFinisher(FormDefinition $formDefinition)
{
$formDefinition->createFinisher('Redirect', [
'pageUid' => 1,
'additionalParameters' => 'param1=value1¶m2=value2',
]);
}
}
This finisher is implemented in
\TYPO3\
.