Page 1 of 1

[SOLVED]google recaptcha error

Posted: Tue Jun 28, 2016 12:01 pm
by santura
I am getting the following error (seen in firebug) on all pages with recaptchas on them.

Error: ReCAPTCHA placeholder element must be empty

Though the pages still function, other js functionality doesn't work. For example - when I empty the cart via the cart button in the header, the cart empties but the details on the button don't update.

Anyone else seen this?

You can see the error at http://barbaramclennan.com/index.php?ro ... on/contact

Re: google recaptcha error

Posted: Wed Jun 29, 2016 3:49 pm
by moused72
Hi
Google reCaptcha work perfect on your site

Re: google recaptcha error

Posted: Fri Jul 01, 2016 12:46 pm
by santura
As I said, the recaptcha works but it throws the error anyway and other functionality doesn't work.
Screenshot_12.jpg

Screenshot_12.jpg (55.68 KiB) Viewed 4038 times


Re: google recaptcha error

Posted: Fri Jul 01, 2016 8:08 pm
by straightlight
Which OC version are you using?

Re: google recaptcha error

Posted: Mon Jul 04, 2016 9:03 pm
by santura
2.0.2.0

Re: google recaptcha error

Posted: Mon Jul 04, 2016 9:35 pm
by straightlight
According to this link: http://stackoverflow.com/questions/2757 ... lid-inputs ,

changing the following in your catalog/view/theme/<your_theme>/template/captcha/google_captcha.tpl file:

Code: Select all

<script src="//www.google.com/recaptcha/api.js" type="text/javascript"></script>
into:

Code: Select all

<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>
Then, at the bottom - to add:

Code: Select all

<script text="text/javascript"><!--
grecaptcha.reset();
//--></script>
would solved the problem. However, another one from this link: https://groups.google.com/forum/#!topic ... UTgPoIKhOk indicates that adding a closing tag to the DIV key would solved the problem like this on the same file:

Code: Select all

<div id="input-payment-captcha" class="g-recaptcha" data-sitekey="<?php echo $site_key; ?>"></div>
into:

Code: Select all

<div id="input-payment-captcha" class="g-recaptcha" data-sitekey="<?php echo $site_key; ?>" /></div>
but I did not tested these.

Re: google recaptcha error

Posted: Tue Jul 05, 2016 2:29 pm
by santura
I don't have that file. It seems to be done differently in my version 2.0.2.0

I did just notice in the header on my contact page, that the recaptcha script is called twice. Maybe this is the issue.

Don't quite know how to fix this though.

Re: google recaptcha error

Posted: Tue Jul 05, 2016 2:31 pm
by santura
I guess the duplicated script is not the issue, as I get the same error on the register page and the script is only called once there

Re: google recaptcha error

Posted: Tue Jul 05, 2016 2:44 pm
by santura
Actually it was the issue, I had the script added in header.tpl probably my mistake. I took it out and the error has disappeared.