• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

grecaptcha.reset();

Guest
May 30, 2018 May 30, 2018

Copy link to clipboard

Copied

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.

Views

11.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 06, 2018 Jun 06, 2018

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' a

...

Votes

Translate

Translate
May 30, 2018 May 30, 2018

Copy link to clipboard

Copied

Hey Slyrfecso,

Have you uploaded your site?

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

Thanks!

Ankush

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 30, 2018 May 30, 2018

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 01, 2018 Jun 01, 2018

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 05, 2018 Jun 05, 2018

Copy link to clipboard

Copied

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>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Jun 06, 2018 Jun 06, 2018

Copy link to clipboard

Copied

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 OShea​ may I ​get your kind view to this?

Regards,

Ankush

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 06, 2018 Jun 06, 2018

Copy link to clipboard

Copied

LATEST

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>

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines