gform_recaptcha_callback

Description

The “gform_recaptcha_callback” JavaScript filter in Gravity Forms allows a custom callback function to be executed when the user successfully submits the captcha.

Usage

1
2
3
4
5
6
7
8
9
gform.addFilter( 'gform_recaptcha_callback', function( callback, elem ) {
      
    callback = function() {
        //do stuff...
        console.log( 'recaptcha executed' );
    };
  
    return callback;
} );

Parameters

  • callback string or function
    The name of the callback function or the function object to be executed when the user successfully submits the captcha.
  • elem object
    The jQuery object containing the div element with the ginput_recaptcha class for the current reCaptcha field.

Example

Add the script

1
2
3
4
5
6
7
gform.addFilter('gform_recaptcha_callback', function(callback, elem) {
    callback = function() {
        // Do stuff...
        console.log('recaptcha executed');
    };
    return callback;
});

Placement

Your code snippet can be placed in an HTML field on your form or in a theme custom JavaScript file.

See also the JavaScript/jQuery section in this article: Where Do I Put This Code?

Source Code

This filter is located in the function renderRecaptcha() in gravityforms/js/gravityforms.js