• Resolved Jason Ryan

    (@viablethought)


    Hello –

    This plugin is throwing the following error in console:

    Uncaught (in promise) Error: reCAPTCHA has already been rendered in this element

    This is happening on pages where there is a separate contact form with recaptcha enabled. We don’t have any recaptcha set for this form so not sure why it is trying to render recaptcha?

    Using the latest version: 1.8.6

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Constant Contact

    (@constantcontact)

    Do you have a link to the site in question? It sounds like there’s other reCAPTCHA in play somehow, and we’d like to see if we can identify how.

    Thread Starter Jason Ryan

    (@viablethought)

    Hello –

    Yep, here is one of them:

    https://www.youngslandscape.com/contact/

    There is a Caldera Forms contact form on the page that is supposed to have recaptcha but since there is a CC Newsletter Sign up form in the right sidebar, this JS error is preventing the recaptcha from rendering on the other form. This was working (probably previous to this last update), may have to roll back to 1.8.5 to see.

    Thanks

    Thread Starter Jason Ryan

    (@viablethought)

    Hello –

    Nope, does the same thing in 1.8.5 as well. Not sure why it is trying to use recaptcha if it is not enabled for the plugin or why it is trying to force someone to use it. This doesn’t seem right at all.

    At what point was the “Spam Control” introduced into the plugin because if you can’t provide a quick fix for this, I may have to roll back to the version before it was added.

    Thanks

    Plugin Author Constant Contact

    (@constantcontact)

    Confirming that I’m seeing this output in the code, which is a little odd because last I knew, we intended to only load parts when needed.

    <script type='text/javascript' src='https://www.youngslandscape.com/wp-content/plugins/constant-contact-forms/assets/js/ctct-plugin-recaptcha-v2.min.js'></script>
    

    Will get back to you with a bit more shortly.

    Thread Starter Jason Ryan

    (@viablethought)

    Hello –

    Same error is showing on 3 other sites we maintain for clients. Hopefully you can fix this soon.

    Plugin Author Constant Contact

    (@constantcontact)

    Can you try dropping this code into one of the sites in question?

    function ctct_support_remove_recaptcha_v2() {
    	$recaptcha_base = new ConstantContact_reCAPTCHA();
    	if ( ! $recaptcha_base::has_recaptcha_keys() ) {
    		wp_dequeue_script('recaptcha-v2');
    		wp_dequeue_script('recaptcha-lib-v2');
    	}
    }
    add_action( 'wp_enqueue_scripts', 'ctct_support_remove_recaptcha_v2' );
    

    What the code will do is check if the site has some reCAPTCHA keys set in the options, and if NOT, then it’ll remove the 2 javascript files from loading in the end. If there are keys, then it will.

    It’s hard to call it a bug because technically things are running as they should. However, I was mistaken in that we were enqueuing only when needed, and I’ll be filing an internal issue to look into changing that.

    Thread Starter Jason Ryan

    (@viablethought)

    Hello –

    That seems to have done the trick. Thanks for the fix.

    Plugin Author Constant Contact

    (@constantcontact)

    Thanks for confirming. Hopefully we’ll have a release out soon that doesn’t require this custom code for you.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘JS Error – Recaptcha’ is closed to new replies.