[New reCAPTCHA] Recaptcha not showing

Forge Component
(11)
Published on 2018-06-01 by Renato Nascimento
11 votes
Published on 2018-06-01 by Renato Nascimento

Hello,

I'm trying to use the new reCaptcha component, but it's not showing up on my page.

I've registered the site on the Google reCaptcha admin console, and I'm using the correct Site key as an input variable.

If I inspect the CSS of the page on Chrome I can tell that there's a div with the class "g-recaptcha" where the reCaptcha is supposed to be, but it's empty.

Does anyone have any suggestions? Thanks!

Is the recaptcha set to appear on page load or is there an ajax refresh where it appears at a later point? Do you have an oml you can share?

Hello,

The recaptcha is set to appear when I click on a button, after an ajax refresh.

I have attached a sample oml.

https://developers.google.com/recaptcha/docs/display#explicit_render - you have to explicitly render it because the recaptcha isn't in the DOM initially. 

I've attached an oml showing how I did it. Basically I just added the javascript it said to in a web block and added it to the screen, passing in the site key. In the screen action wherever you're using the ajax refresh to display it, you need to reload this web block and click the button via RunJavascript that calls the javascript callback for loading the recaptcha. Obviously this site key is fake because I can't use my own but it should work once you add yours.

Sorry for the delay in response.