Skip to content

Commit a6cd802

Browse files
committed
Fixed so it works with toggleDisabled using callbacks from grecaptcha.render()
1 parent 5d19135 commit a6cd802

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/modules/security.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,9 +568,18 @@
568568
throw new Error('Google reCaptcha site key is required.');
569569
}
570570

571+
var grecaptchaRenderCallback = function(result) {
572+
$('form').each(function(){
573+
$('[data-validation~="recaptcha"]',$(this)).each(function() {
574+
$(this).trigger('validation', (result && result !== ''));
575+
});
576+
});
577+
};
571578
var widgetId = grecaptcha.render(div, {
572579
sitekey: siteKey,
573-
theme: theme
580+
theme: theme,
581+
callback: grecaptchaRenderCallback,
582+
'expired-callback': grecaptchaRenderCallback
574583
});
575584

576585
$input

0 commit comments

Comments
 (0)