This documentation is for developers that want to implement their own callback to react on the invisible recaptcha. === Required: hook_recaptcha_callback_alter($callback, $captcha) === The hook_recaptcha_callback_alter() hook is the only required function if you want to alter the implementation of the invisible recaptcha callback function. First of all define the name of your javascript fallback function: * 'callback': return a string * 'captcha': this is the captcha array from the captcha module's hook_captcha. Here you can add your custom javascript file from your module. In this javascript file the custom callback function should be defined. Let's give a simple example to make this more clear. """ custom_module.module /** * Implements hook recaptcha_callback * @see recaptcha_captcha * @param string $callback * @param array $captcha */ function custom_module_recaptcha_callback_alter(&$callback, &$captcha) { $custom_js = array( drupal_get_path('module', 'custom_module') . '/js/invisible-recaptcha-custom.js', ); $captcha['form']['#attached']['js'] = $custom_js; $callback = 'onCustomInvisibleSubmit'; } """ js/custom_js.js /* * Override invisible-recaptcha.js - onInvisibleSubmit(token) callback function * re-use the filled in submittedFormId variable from validateInvisibleCaptcha */ function onInvisibleWebformSubmit(token) { // retrieve the form where the captcha applied to - stored in var submittedFormId // see invisible-recaptcha.js var $form = jQuery(document.getElementById(submittedFormId)); //Check if we're handling a webform if($form.attr('id').indexOf('webform-client-form') >= 0) { // If we have a webform and a multifile upload, make sure to reset that first if($form.has('.webform-component-multifile').length > 0) { // Empty Element Fix!!! see jquery.MultiFile.js:45 // this code will automatically intercept native form submissions and disable empty file elements // As we intercepted the form submit and handling it now asynchronously we need to invoke this ourselves jQuery.fn.MultiFile.disableEmpty(); } } //submit the form $form.submit(); }