1

We use Sitecore 8.1 and started seeing an issue with ReCaptcha in WFFM forms, we get the following error.

Uncaught Error: reCAPTCHA placeholder element must be empty
   at Yp (recaptcha__en.js:511)
   at recaptcha__en.js:513
   at Array.forEach ()
   at cL (recaptcha__en.js:513)
   at Rn (recaptcha__en.js:519)
   at w3 (recaptcha__en.js:518)
   at recaptcha__en.js:524
   at recaptcha__en.js:544

Upon checking on the error, it happens when google's api.js (https://www.google.com/recaptcha/api.js) load multiple times and the solution is to make the script load async defer (), how do I do that in Sitecore? Any help is appreciated.

1

This error comes when you have included the re-captcha library twice.

Check for the following if you have this twice accidentally.

https://www.google.com/recaptcha/api.js

Check if you are using the rendering having this code twice on a page.

  • I don't think we need to add anything in the rendering that enables reCaptcha, that is a feature which comes out of the box, so long story short there is nowhere we add this script explicitly in our solution. – Abhi Aug 12 at 14:33
  • Do you have Recaptchafield.cshtml in your solution? You can check and if possible you can customize it. – Prashant Tomar Aug 14 at 12:14
  • It resides in the \Views\Form\EditorTemplates folder. It uses the model generated from Sitecore.Forms.MVC.dll. You can decompile the dll and see the logic, and on the basis of that customize the Recaptchafield.cshtml according to your need. – Prashant Tomar Aug 14 at 12:43
  • Thanks for your time in responding, I exactly took the same route before even I got to your comment and customized my view according to my need. – Abhi Aug 14 at 23:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.