WordPress.org

Ready to get started?Download WordPress

Forums

Jetpack by WordPress.com
[resolved] Contact Form/PollDaddy & ReCaptcha bug (3 posts)

  1. Marcus
    NetWebLogic Support
    Posted 1 year ago #

    I had a user having a problem with Events Manager (I'm the author) and JetPack.

    The Problem:
    Near the end of an AJAX call to book an event, we check if there's a recaptcha form that needs reloading by seeing if the Recaptcha variable is set, if so we call Recaptcha.reload().

    This is a valid method described here - https://developers.google.com/recaptcha/docs/display?hl=en#AJAX

    Your script then hits a fatal error and our ajax doesn't complete, messing the booking flow so our ajax call doesn't finish and exits. The offending file on your side is:
    wp-content/plugins/jetpack/modules/sharedaddy/sharing.js?ver=20121205

    The JS error :

    Uncaught ReferenceError: RecaptchaState is not defined

    This happens if we enable sharing.

    I've made some workarounds (not publicly yet), so everything keeps working, but the fatal error is still there without (any known) side-effects. Any insight would be appreciated.

    http://wordpress.org/extend/plugins/jetpack/

    Update - I've added a check to make sure RecaptchaState is defined, the error goes away.

    I still wonder if this is still a bug on your side though, since Recaptcha probably shouldn't be defined in the first place if RecaptchaState isn't. I also don't see any similar code in the recaptcha js supplied by google (both ajax and standard).

  2. George Stephanis
    Automattic Lead Code Monkey
    Plugin Author

    Posted 11 months ago #

    Howdy, Marcus.

    After some research on my own, it seems this isn't a Jetpack occurrence, but something that happens due to the code we get from Google:

    http://plugins.trac.wordpress.org/browser/jetpack/trunk/modules/sharedaddy/sharing.js#L340

    I found a worthwhile discussion on the topic here:

    https://groups.google.com/forum/#!topic/recaptcha/yCJJNc2rc5k

    that suggests the following rectifies it if run after a recaptcha is loaded onto the page after pageload: https://groups.google.com/d/msg/recaptcha/yCJJNc2rc5k/PHVanskm01cJ

    function showRecaptcha(element) {
    Recaptcha.create("{{RECAPTCHA_PUBKEY}}" , element, {
    theme: "red"
    });
    }

    -- they suggested running it on a setInterval, but I suspect if it runs as part of the handler function for the ajax call, it would work just as well.

  3. Marcus
    NetWebLogic Support
    Posted 11 months ago #

    It seems so...

    Oh well, after adding my check above it works, so will leave it at that for now :)

    Thanks for the reply!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic