@@ -73,8 +73,14 @@ define(
7373 * @param {String } token
7474 */
7575 reCaptchaCallback : function ( token ) {
76+ var submitButton ;
77+
7678 if ( this . getIsInvisibleRecaptcha ( ) ) {
7779 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+ }
7884 this . $parentForm . submit ( ) ;
7985 }
8086 } ,
@@ -155,18 +161,17 @@ define(
155161
156162 if ( this . getIsInvisibleRecaptcha ( ) && parentForm . length > 0 ) {
157163 parentForm . submit ( function ( event ) {
164+ var submitButton ;
165+
158166 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+ }
159171 // eslint-disable-next-line no-undef
160172 grecaptcha . execute ( widgetId ) ;
161173 event . preventDefault ( event ) ;
162174 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- }
170175 }
171176 } . bind ( this ) ) ;
172177
0 commit comments