Jump to main content Jump to doc navigation

The recaptcha hook

The recaptcha hook will enable reCaptcha support for FormIt forms.

Usage

First off, add "recaptcha" to your &hooks parameter in your FormIt call. Then you'll need to include the following placeholders in your form:

[[+formit.recaptcha_html]]
[[!+fi.error.recaptcha]]

The first placeholder is where the reCaptcha form will be rendered; the 2nd is the error message (if any) for reCaptcha.

Finally, you'll need to setup your reCaptcha private and public keys in System Settings. The settings available for reCaptcha are:

Name Description
formit.recaptcha_public_key Your reCaptcha public key.
formit.recaptcha_private_key Your reCaptcha private key.
formit.recaptcha_use_ssl Whether or not to use SSL for reCaptcha requests. Defaults to false.

Available Properties

The reCaptcha hook has a few extra configuration options:

Name Description Default
recaptchaJs A JSON object to pass into the RecaptchaOptions var, which configures the reCaptcha widget. See the official reCaptcha docs for more information. {}
recaptchaTheme The recaptcha theme to use. clean

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