@@ -73,8 +73,14 @@ define(
73
73
* @param {String } token
74
74
*/
75
75
reCaptchaCallback : function ( token ) {
76
+ var submitButton ;
77
+
76
78
if ( this . getIsInvisibleRecaptcha ( ) ) {
77
79
this . tokenField . value = token ;
80
+ submitButton = this . $parentForm . find ( 'button:not([type]), [type=submit]' ) ;
81
+ if ( submitButton . length ) { //eslint-disable-line max-depth
82
+ submitButton . attr ( 'disabled' , false ) ;
83
+ }
78
84
this . $parentForm . submit ( ) ;
79
85
}
80
86
} ,
@@ -155,18 +161,17 @@ define(
155
161
156
162
if ( this . getIsInvisibleRecaptcha ( ) && parentForm . length > 0 ) {
157
163
parentForm . submit ( function ( event ) {
164
+ var submitButton ;
165
+
158
166
if ( ! this . tokenField . value ) {
167
+ submitButton = this . $parentForm . find ( 'button:not([type]), [type=submit]' ) ;
168
+ if ( submitButton . length ) { //eslint-disable-line max-depth
169
+ submitButton . attr ( 'disabled' , true ) ;
170
+ }
159
171
// eslint-disable-next-line no-undef
160
172
grecaptcha . execute ( widgetId ) ;
161
173
event . preventDefault ( event ) ;
162
174
event . stopImmediatePropagation ( ) ;
163
- if ( this . $parentForm . valid ( ) ) {
164
- let formSubmitButton = this . $parentForm . find ( 'button:not([type]), [type=submit]' ) ;
165
-
166
- if ( formSubmitButton . length ) { //eslint-disable-line max-depth
167
- formSubmitButton . attr ( 'disabled' , true ) ;
168
- }
169
- }
170
175
}
171
176
} . bind ( this ) ) ;
172
177
0 commit comments