locked
What is captchaWidgetId regarding google re-captcha RRS feed

  • Question

  • User264732274 posted

    see the below code and there they use captchaWidgetId what it is ?

    code taken from http://y-designs.com/blog/google-recaptcha-v2-on-a-dynamic-page/

    document.getElementById("submit").onclick = function() {
        // Grab the captcha response. Note that we have to use the widget id that we stored earlier (not the <div> id!).
        var response = grecaptcha.getResponse( captchaWidgetId );
        console.log( 'g-recaptcha-response: ' + response );
        // proceed to submit the form or whatever you happen to be doing.
    };
    Wednesday, October 5, 2016 11:06 AM

Answers

  • User-835544317 posted

    captchaWidgetId is the variable that will contain the grecaptcha.render() value. See the below link and search for grecaptcha.getResponse  wand you will understand it..

    https://developers.google.com/recaptcha/docs/display

    Hope this help.. Please mark it if this helped you in answering your question.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 5, 2016 3:48 PM
  • User283571144 posted

    Hi sudip_inn,

    see the below code and there they use captchaWidgetId what it is ?

    According to the article you posted, the captchaWidgetId is the reCAPTCHA newly created ID.

    See below codes:

    var captchaWidgetId = grecaptcha.render( 'myCaptcha', {
      'sitekey' : 'your_site_key',  // required
      'theme' : 'light',  // optional
      'callback': 'verifyCallback'  // optional
    });
    

    According to reCAPTCHA API:

    Grecaptcha.render method will renders the container as a reCAPTCHA widget and returns the ID of the newly created widget.

    Best Regards,

    Brando

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, October 7, 2016 5:58 AM

All replies

  • User-835544317 posted

    captchaWidgetId is the variable that will contain the grecaptcha.render() value. See the below link and search for grecaptcha.getResponse  wand you will understand it..

    https://developers.google.com/recaptcha/docs/display

    Hope this help.. Please mark it if this helped you in answering your question.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 5, 2016 3:48 PM
  • User283571144 posted

    Hi sudip_inn,

    see the below code and there they use captchaWidgetId what it is ?

    According to the article you posted, the captchaWidgetId is the reCAPTCHA newly created ID.

    See below codes:

    var captchaWidgetId = grecaptcha.render( 'myCaptcha', {
      'sitekey' : 'your_site_key',  // required
      'theme' : 'light',  // optional
      'callback': 'verifyCallback'  // optional
    });
    

    According to reCAPTCHA API:

    Grecaptcha.render method will renders the container as a reCAPTCHA widget and returns the ID of the newly created widget.

    Best Regards,

    Brando

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, October 7, 2016 5:58 AM