Jump to main content Jump to doc navigation

The 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

  1. FormIt.Hooks.email
  2. FormIt.Hooks.FormItAutoResponder
  3. FormIt.Hooks.FormItSaveForm
  4. FormIt.Hooks.math
  5. FormIt.Hooks.recaptcha
  6. FormIt.Hooks.redirect
  7. FormIt.Hooks.spam
  8. 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

  • modmore
  • STERC
  • Digital Penguin
  • Jens Wittmann – Gestaltung & Entwicklung
  • Fabian Christen
  • Dannevang Digital
  • Sepia River Studios
  • CrewMark
  • Chris Fickling
  • deJaya
  • eydolan
  • Lefthandmedia
  • Murray Wood
  • Following Sea
  • Anton Tarasov
  • Stéphane Jäggi
  • Raffy
  • Snow Creative
  • A. Moreno
  • Nick Clark
  • JT Skaggs
  • Helen
  • YJ
  • krisznet
  • Richard
  • Yanni

Budget

$306 per month—let's make that $500!

Learn more