redirect
Last updated Nov 27th, 2019 | Page history | Improve this page | Report an issue
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$301 per month—let's make that $500!
Learn moreThe redirect hook¶
The redirect hook will redirect the user to a specified Resource when their form finishes submitting. It requires one parameter, redirectTo, which must the ID of the Resource you want to redirect to. The field values will not be forwarded.
Available Properties¶
name | description |
---|---|
redirectTo | Required. The ID of the resource to to redirect the user to on a successful submission. |
redirectParams | A JSON object of parameters to pass in the redirect URL. |
Note that this can also be used with the &store property to send the form values off to the redirected-to page, using the FormItRetriever snippet.
Usage¶
Just include the redirect hook in your &hooks property on the FormIt call. Then specify the ID of the Resource to redirect to with the &redirectTo property.
Redirecting with Parameters¶
You can specify parameters to redirect with when using this hook. Simply use the &redirectParams property:
[[!FormIt?
&hooks=`redirect`
&redirectTo=`212`
&redirectParams=`{"user":"123","success":"1"}`
]]
That will build the URL with those params. Say the Resource ID 212 is at books.html, then the redirect URL would be:
- books.html?user=123&success=1
See Also¶
- FormIt.Hooks.email
- FormIt.Hooks.FormItAutoResponder
- FormIt.Hooks.FormItSaveForm
- FormIt.Hooks.math
- FormIt.Hooks.recaptcha
- FormIt.Hooks.redirect
- FormIt.Hooks.spam
- FormIt.PreHooks.FormItLoadSavedForm
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$301 per month—let's make that $500!
Learn more