MODX Community

ReCaptcha v3 Not Functioning

I am trying to get ReCaptcha v3 to work on a contact form, but it simply does nothing and the form submits anyway. I looked at the documentation and lifted the code from that, but no success. The proper v3 API keys were entered in system settings, no other changes there were made.

[[!FormIt?
   &hooks=`recaptchav3,spam,FormItSaveForm,email,redirect`
   &fsFormTopic=`contact`
   &emailTpl=`ContactEmailChunk`
   &redirectTo=`38`
   &formName=`Contact Form`
   &validate=`nospam:blank`
   &submitVar=`contactsubmit`
   &recaptchav3.token_key=`token-1`
   &recaptchav3.action_key=`action-1`
]]

Below the submit button in the form. The tpl has not been modified:

[[!recaptchav3_render?
&tpl=`recaptchav3_html`
&token_key=`token-1`
&action_key=`action-1`
]]
[[!+fi.error.recaptchav3_error]]

Does anyone have an idea of why this is happening? The site is getting a lot of spam through the form, even with a good jquery validator.

EDIT: It shows the floating ReCaptcha logo on the left side of the page, but nothing else. I hid it with some CSS and put the policies below the submit button instead.

1 Like

Hi @ShatteredSite – can you tell us how you’re testing and know that nothing is happening? Recaptca v3 is the invisible one, so you won’t see a checkbox, and if you’re not a bot then when you submit the form it will just submit. The only way I know to see if Recaptcha is actually stopping bad guys is to check the Recaptcha admin dashboard. But I believe you have to let it run for a few days to collect data.
https://www.google.com/recaptcha/admin/

Unfortunately the admin site just shows numbers of requests and percent that were considered suspicious. No detail other than that. But at least you can tell it is working…

Maybe some other folks will chime in with better ways to check Recaptcha actions.

2 Likes

I didn’t realize it was completely invisible, thanks for clarifying.

Last night I added data-sitekey attribute to the submit button, and now it’s working. I had seen it in a tutorial online somewhere. I’m not certain why it needed it, but it worked.

Thanks!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.