6 Replies Latest reply on Jun 6, 2018 5:09 PM by Nancy OShea

    grecaptcha.reset();

    Slyrfecso

      Hi,

       

      I'd like to use Google Captcha 2.0 on our website.

      The plugin is working well alone, but if I use that on different forms in tabbed composition,

      then the verification is not finishing just spinning.

      Forms are hidden at the first time, therefor I need to reset that every time if I click on the tab.

       

       

       

      Only solution what I have found the "grecaptcha.reset();"

      I tried to integrate in Muse but without success.

       

      I inserted html widget in Muse on focused tab:

      <script>
      grecaptcha.reset(widgetu62258_recaptcha2);
      </script>
      

       

      TypeError: grecaptcha.reset is not a function. (In 'grecaptcha.reset(widgetu62258_recaptcha2)', 'grecaptcha.reset' is undefined)

       

      Any idea will be helpful.

      Thx.

        • 1. Re: grecaptcha.reset();
          ankushr40215001 Level 7

          Hey Slyrfecso,

           

          Have you uploaded your site?

           

          Would like to have a look at it for further testing.

           

           

          Thanks!

          Ankush

          • 2. Re: grecaptcha.reset();
            Slyrfecso Level 1

            Hi Staff,

             

            Yes sure, you could try it:

            ALEX Bútor főoldal

            (Stay on hungarian language)

             

             

            Scroll down to message sender and click on any of our business lines.

            (Hotel, Öltöző, Iroda, Iskola, Óvoda, Utca, Általános...)

             

            Thx.

            • 3. Re: grecaptcha.reset();
              Slyrfecso Level 1

              Hi,

               

              I'm a little closer.

              I need to find first the tab button, than I can run reset.

               

              <script type="text/javascript">
              document.getElementById("u62014popup").onclick = function(){
              grecaptcha.reset(widgetu62333);
              }
              </script>
              

               

              The problem is I can't find right recaptcha id.

              I tried with " " and with ' '.

               

              ReferenceError: Can't find variable: Recaptcha

               

               

              Any idea?

              Thx.

              • 4. Re: grecaptcha.reset();
                Slyrfecso Level 1

                Hi,

                 

                The first is working well, but the second or more not.

                (If I use only 1 than working well.)

                I idea why not?

                 

                 

                <script type="text/javascript">
                document.getElementById("u40384popup").onclick = function(){
                var recaptcha1;
                var myCallBack = function() {
                    //Render the recaptcha1 on the element with ID "recaptcha1"
                    recaptcha1 = grecaptcha.render('widgetu60189', {
                        'sitekey' : '6LcKHFwUAAAAAMxP2P0RyMJO3mKBcrP4KUYpWGa5', //HOTEL-VENDEGLATO
                        'theme' : 'light'
                    });
                };
                
                
                grecaptcha.reset(recaptcha1);
                }
                
                
                
                
                document.getElementById("u40383popup").onclick = function(){
                var recaptcha2;
                var myCallBack = function() {
                    //Render the recaptcha1 on the element with ID "recaptcha1"
                    recaptcha2 = grecaptcha.render('widgetu60208', {
                        'sitekey' : '6LctsVwUAAAAAI4aOImYujtYuLFeOlHSnhbLYUrq', //OLTOZO
                        'theme' : 'light'
                    });
                };
                
                
                grecaptcha.reset(recaptcha2);
                }
                </script>
                
                • 5. Re: grecaptcha.reset();
                  ankushr40215001 Level 7

                  Sorry to say I am not that good coding, probably will try to get hold of any code expert within the community for help.

                   

                  Hey Nancy, may I get your kind view to this?

                   

                   

                  Regards,

                  Ankush

                  • 6. Re: grecaptcha.reset();
                    Nancy OShea Adobe Community Professional & MVP

                    If you use more than one reCAPTCHA per page, you must give each one an explicit ID.

                    var widgetID1;

                    var widgetID2;

                    etc...

                    reCAPTCHA v2  |  reCAPTCHA  |  Google Developers

                     

                    <html>
                     
                    <head>
                       
                    <title>reCAPTCHA demo: Explicit render for multiple widgets</title>
                       
                    <script type="text/javascript">
                         
                    var verifyCallback = function(response) {
                            alert
                    (response);
                         
                    };
                         
                    var widgetId1;
                         
                    var widgetId2;
                         
                    var onloadCallback = function() {
                           
                    // Renders the HTML element with id 'example1' as a reCAPTCHA widget.
                           
                    // The id of the reCAPTCHA widget is assigned to 'widgetId1'.
                            widgetId1
                    = grecaptcha.render('example1', {
                             
                    'sitekey' : 'your_site_key',
                             
                    'theme' : 'light'
                           
                    });
                            widgetId2
                    = grecaptcha.render(document.getElementById('example2'), {
                             
                    'sitekey' : 'your_site_key'
                           
                    });
                            grecaptcha
                    .render('example3', {
                             
                    'sitekey' : 'your_site_key',
                             
                    'callback' : verifyCallback,
                             
                    'theme' : 'dark'
                           
                    });
                         
                    };
                       
                    </script>
                     
                    </head>
                     
                    <body>
                       
                    <!-- The g-recaptcha-response string displays in an alert message upon submit. -->
                       
                    <form action="javascript:alert(grecaptcha.getResponse(widgetId1));">
                         
                    <div id="example1"></div>
                         
                    <br>
                         
                    <input type="submit" value="getResponse">
                       
                    </form>
                       
                    <br>
                       
                    <!-- Resets reCAPTCHA widgetId2 upon submit. -->
                       
                    <form action="javascript:grecaptcha.reset(widgetId2);">
                         
                    <div id="example2"></div>
                         
                    <br>
                         
                    <input type="submit" value="reset">
                       
                    </form>
                       
                    <br>
                       
                    <!-- POSTs back to the page's URL upon submit with a g-recaptcha-response POST parameter. -->
                       
                    <form action="?" method="POST">
                         
                    <div id="example3"></div>
                         
                    <br>
                         
                    <input type="submit" value="Submit">
                       
                    </form>
                       
                    <script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit"
                           
                    async defer>
                       
                    </script>
                     
                    </body>
                    </html>

                    1 person found this helpful