Callback for Google Recaptcha and Parsley validation

I’m testing Parsley validation and Google Recaptcha API.

Need to know how to do correct (working) Javascript.


<div class="g-recaptcha" data-sitekey="" data-callback="captcha_container"></div>


    var captchaContainer = null;
    var loadCaptcha = function() {
      captchaContainer = grecaptcha.render('captcha_container', {
        'sitekey' : 'XXX',
        'callback' : function(response) {

Is this correct to validate form if Recaptcha is status as validated?

Is it possible to reply?

Based on

You should get back a g-recaptcha-response as the input to your callback function. That response will be an object of some sort (maybe JSON). And looks to contain properties for success and error-codes that you will need to evaluate to determine if the recaptcha was successful

I have set HTML hidden field.

Form includes input:

<div class="g-recaptcha" data-sitekey="" data-callback="captchaCallback"></div>

<input type="hidden" name="hibot" id="Hibot" value="Sorry Bot!">
<input type="hidden" name="completed_captcha" id="completed_captcha" required data-parsley-equalto="#Hibot" />

As form includes Google Recaptcha updated version, how to do in the correct way captchaCallback?

Need help.Thank you.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.