How can I make reCAPTCHA a required field?

前端 未结 7 1289
闹比i
闹比i 2020-12-01 05:34

I\'m using Google reCAPTCHA and have been able to add the CAPTCHA component to my page inside a form. But when I submit the form there\'s no validation taking place to check

7条回答
  •  孤独总比滥情好
    2020-12-01 06:01

    I find this very helpful:

    You add a function to data-callback="recaptchaCallback" with this code:

    var recaptchachecked=false; 
    function recaptchaCallback() {
        recaptchachecked = true;
    }
    

    and a function were you return the value to use it in a other html-tag like this:

    function isreCaptchaChecked() { return recaptchachecked; }

    I hope this helps you.

提交回复
热议问题