File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 519
519
name : 'recaptcha' ,
520
520
validatorFunction : function ( val , $el )
521
521
{
522
- return grecaptcha . getResponse ( $el . valAttr ( 'recaptcha-widget-id' ) ) ;
522
+ return grecaptcha . getResponse ( $el . valAttr ( 'recaptcha-widget-id' ) ) !== '' ;
523
523
} ,
524
524
errorMessage : '' ,
525
525
errorMessageKey : 'badreCaptcha'
568
568
throw new Error ( 'Google reCaptcha site key is required.' ) ;
569
569
}
570
570
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
+ } ;
571
578
var widgetId = grecaptcha . render ( div , {
572
579
sitekey : siteKey ,
573
- theme : theme
580
+ theme : theme ,
581
+ callback : grecaptchaRenderCallback ,
582
+ 'expired-callback' : grecaptchaRenderCallback
574
583
} ) ;
575
584
576
585
$input
You can’t perform that action at this time.
0 commit comments