function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Saravanan Raju7Saravanan Raju7 

ReCaptcha in Web To Lead

Hi All,
I am creating a web-to-lead form in wordpress site and added Invisible recaptcha in the code. But still I am getting the normal recaptcha with 'I am not robot' checkbox. Could you please help how to implement Invisible recaptcha in SF web to lead form.

Below are the sample code added to the exising web to lead form

</style>
<script src="https://www.google.com/recaptcha/api.js"></script>
<script>
function timestamp() { var response = document.getElementById("g-recaptcha-response"); if (response == null || response.value.trim() == "") {var elems = JSON.parse(document.getElementsByName("captcha_settings")[0].value);elems["ts"] = JSON.stringify(new Date().getTime());document.getElementsByName("captcha_settings")[0].value = JSON.stringify(elems); } } setInterval(timestamp, 500);
</script>
<script type="text/javascript">

<input type=hidden name='captcha_settings' value='{"keyname":"Invisible","fallback":"true","orgId":"00D..,"ts":""}'>

<div class="g-recaptcha" data-sitekey="6L...."></div><br>

Please help.

Best Answer chosen by Saravanan Raju7
Saravanan Raju7Saravanan Raju7
I have changed my code as per the instructions given in the below link (Automatically bind the challenge to a button), it resolved my issue. https://developers.google.com/recaptcha/docs/invisible

Another link I recommend to refer is - https://stackoverflow.com/questions/41079335/implement-the-new-invisible-recaptcha-from-google

All Answers

PriyaPriya (Salesforce Developers) 

Hi Saravanan,

Kindly refer this below link :- 
https://www.sfdcpoint.com/salesforce/salesforce-web-to-lead-form-with-recaptcha/

You might need to modify it accordingly.

If this solve your issue, please mark it as best answer.

Regards,

Priya Ranjan

Saravanan Raju7Saravanan Raju7

Thank you Priya, for your quick response.

But I have refered the same link, while creating the reCaptcha with the "Invisible reCaptcha" option, still it is working same as normal option (with 'I am not robot' checkbox enabled). But ideally, user should not click the checkbox, it should be hidden or working in backend. 

Saravanan Raju7Saravanan Raju7
I have changed my code as per the instructions given in the below link (Automatically bind the challenge to a button), it resolved my issue. https://developers.google.com/recaptcha/docs/invisible

Another link I recommend to refer is - https://stackoverflow.com/questions/41079335/implement-the-new-invisible-recaptcha-from-google
This was selected as the best answer