recaptcha
Last updated May 27th, 2026 | 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
$0 per month—let's make that $500!
Learn moreThe recaptcha hook¶
The recaptcha hook enables reCAPTCHA v3 support for FormIt forms. reCAPTCHA v3 works invisibly in the background — no checkbox or challenge is shown to the user. Google returns a score (0.0–1.0) indicating how likely the submission is from a human; submissions below the minimum score are rejected.
Requirements¶
- A reCAPTCHA v3 site key and secret key from https://www.google.com/recaptcha
- FormIt's frontend JS enabled via the
formit.frontend_jssystem setting (set tojs/web/formit.js)
Usage¶
Add recaptcha to your &hooks parameter:
[[!FormIt?
&hooks=`recaptcha,email`
]]
Add the reCAPTCHA placeholder and the error placeholder to your form:
[[+formit.recaptcha_html]]
[[!+fi.error.recaptcha]]
[[+formit.recaptcha_html]] renders two hidden fields (g-recaptcha-response and g-recaptcha-action) required for v3. FormIt automatically loads the Google reCAPTCHA script and executes the token request on form submit.
System Settings¶
Configure your keys in System Settings under the formit_recaptcha area:
| Setting | Description | Default |
|---|---|---|
formit.recaptcha_site_key |
Your reCAPTCHA v3 site key (public). | |
formit.recaptcha_secret_key |
Your reCAPTCHA v3 secret key (private). | |
formit.recaptcha_min_score |
Minimum score to accept a submission (0.0–1.0). | 0.5 |
Available Properties¶
| Name | Description | Default |
|---|---|---|
recaptchaAction |
Action name sent to Google with the token request. Visible in the reCAPTCHA admin dashboard. | submit |
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
$0 per month—let's make that $500!
Learn more