Answer the question
In order to leave comments, you need to log in
How to catch the Google reCaptcha cancellation event, what if the user suddenly canceled the recaptcha input?
The bottom line is that there is a sending using ajax.
There is a sendingForm variable that prevents the user from multiple clicks on the "send" form button.
We set it before sending, as we check if true, return; if not, it continues to execute the code where we call the recaptcha, and here is the stupor.
If the user canceled the recaptcha, just as accidentally, missed the window or something else, then our sendingForm variable is still == true and the user cannot send the form already, because we are checking if the form is being sent before sending it.
Our code that sets the verification variable to sendingForm = false is in the callback function to the recaptcha.
If the user sent a response, clicked on the captcha test, failed it or passed, we get everything in the callback function and work with the answer there.
validate: function () {
if (this.formSending) return;
// validate form data
this.$validator.validateAll().then((result) => {
if (grecaptcha) {
this.formSending = true;
grecaptcha.execute();
}
});
},
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question