Disable Submit until reCAPTCHA is clicked

PHOTO EMBED

Sun Dec 10 2023 08:38:04 GMT+0000 (Coordinated Universal Time)

Saved by @Kiwifruit #forms #recaptcha #captcha

<script is:inline>
    document.getElementById('wf-form-Digital-Wings-Contact-Page-Form').addEventListener('submit', function (event) {
      if (window.grecaptcha.getResponse().length > 0) { return; }
      event.preventDefault();
    });
</script>
content_copyCOPY

Used on the Digital Wings site to prevent a form from appearing to be sent when a user clicks the submit button without clicking the reCAPTHA button first. When this happens reCAPTCHA reloads the form page erasing any data the user may have entered leaving the user unsure if the form was submitted correctly. This script disables the form's submit button until the reCAPTCHA has been clicked.

https://answers.netlify.com/t/know-if-recaptcha-v2-was-checked-or-not/41271/14