I have a form that sends an AJAX request to the server. If the form does not validate using regular Laravel validation rules, I then get a response of ["timeout-or-duplicate"] when I re-submit the form because the nonce used with the reCAPTCHA field has already been used and Google is detecting a replay event. When this happens, the only way to submit the form is to refresh the page and re-enter all of the information again. I see 3 problems here:
The server should not attempt to validate the reCAPTCHA field if regular form validation fails. Only when regular validation passes, the server should validate reCAPTCHA. This way the user doesn't have to re-validate reCAPTCHA because of an unrelated field failing validation.
If the reCAPTCHA validation fails, the field should be reset so that the user can verify it is not a robot again. Having to refresh the page and re-enter everything again is a huge inconvenience.
A reCAPTCHA fail should not prevent regular form validation from happening. At least I'm assuming that this is what is happening because the whole response is ["timeout-or-duplicate"]. Consider appending the errors to X_OCTOBER_ERROR_FIELDS in the AJAX response.
I have a form that sends an AJAX request to the server. If the form does not validate using regular Laravel validation rules, I then get a response of
["timeout-or-duplicate"]
when I re-submit the form because the nonce used with the reCAPTCHA field has already been used and Google is detecting a replay event. When this happens, the only way to submit the form is to refresh the page and re-enter all of the information again. I see 3 problems here:["timeout-or-duplicate"]
. Consider appending the errors toX_OCTOBER_ERROR_FIELDS
in the AJAX response.