# "Refresh" a Captcha without refreshing the page

**URL:** <https://forum.bubble.io/t/refresh-a-captcha-without-refreshing-the-page/9395>\
**Category:** Need help\
**Created:** [January 9, 2017, 3:44pm UTC](https://forum.bubble.io/t/refresh-a-captcha-without-refreshing-the-page/9395 "2017-01-09T15:44:44Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![rhinoted](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/rhinoted/32/8352_2.png) [@rhinoted](https://forum.bubble.io/u/rhinoted)\
**Post date:** [January 9, 2017, 3:44pm UTC](https://forum.bubble.io/t/refresh-a-captcha-without-refreshing-the-page/9395/1 "2017-01-09T15:44:44Z")

</div>

After the data is entered I would like the Captcha to “uncheck” itself. Is it possible?

I found this on google website, I don’t know if is i possible to use it and integrate with the bubble recaptcha plugin.

“**We recommend using the grecaptcha.reset() javascript function to reset the reCAPTCHA widget.**”

thanks!

---

<div class="post-metadata">

**Author:** ![john3](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/john3/32/5625_2.png) [@john3](https://forum.bubble.io/u/john3)\
**Post date:** [January 9, 2017, 4:09pm UTC](https://forum.bubble.io/t/refresh-a-captcha-without-refreshing-the-page/9395/2 "2017-01-09T16:09:27Z")

</div>

Did you try using reset inputs in the workflow?

---

<div class="post-metadata">

**Author:** ![rhinoted](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/rhinoted/32/8352_2.png) [@rhinoted](https://forum.bubble.io/u/rhinoted)\
**Post date:** [January 9, 2017, 4:13pm UTC](https://forum.bubble.io/t/refresh-a-captcha-without-refreshing-the-page/9395/3 "2017-01-09T16:13:13Z")

</div>

Yes I also tried to put the recaptcha in a group and resetting the group but nope…

---

<div class="post-metadata">

**Author:** ![john3](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/john3/32/5625_2.png) [@john3](https://forum.bubble.io/u/john3)\
**Post date:** [January 9, 2017, 4:51pm UTC](https://forum.bubble.io/t/refresh-a-captcha-without-refreshing-the-page/9395/4 "2017-01-09T16:51:42Z")

</div>

It’s odd that with this element in conditions you can’t control it’s check setting only if it’s visible or not.  
To me that indicates you have no control over re-setting it’s state beyond reloading the page.

The one workaround I would try is using it an a popup - you enter your data and check the recaptcha dialog in the popup and submit. When you enter a new one the popup should automatically reset everything and let you stay on the same page - not sure if it will work.

---

<div class="post-metadata">

**Author:** ![rhinoted](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/rhinoted/32/8352_2.png) [@rhinoted](https://forum.bubble.io/u/rhinoted)\
**Post date:** [January 9, 2017, 6:20pm UTC](https://forum.bubble.io/t/refresh-a-captcha-without-refreshing-the-page/9395/5 "2017-01-09T18:20:37Z")

</div>

ok thanks… no way to send to the element this grecaptcha.reset() javascript function?

---

<div class="post-metadata">

**Author:** ![john3](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/john3/32/5625_2.png) [@john3](https://forum.bubble.io/u/john3)\
**Post date:** [January 9, 2017, 7:27pm UTC](https://forum.bubble.io/t/refresh-a-captcha-without-refreshing-the-page/9395/6 "2017-01-09T19:27:44Z")

</div>

Maybe - I don’t know enough about that function.

---

<div class="post-metadata">

**Author:** ![scottb50](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/scottb50/32/9334_2.png) [@scottb50](https://forum.bubble.io/u/scottb50)\
**Post date:** [January 9, 2017, 9:41pm UTC](https://forum.bubble.io/t/refresh-a-captcha-without-refreshing-the-page/9395/7 "2017-01-09T21:41:09Z")

</div>

Doesn’t it defeat the purpose? If not, use a less sophisticated captcha or roll your own and run it randomly. personally I wouldn’t try to spoof Google, especially in a shared hosting environment.

More important, what security measures does bubble have in place for (bot) attacks in the wild? Is there security insurance? Would we be covered?

---

<div class="post-metadata">

**Author:** ![rhinoted](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/rhinoted/32/8352_2.png) [@rhinoted](https://forum.bubble.io/u/rhinoted)\
**Post date:** [January 9, 2017, 9:46pm UTC](https://forum.bubble.io/t/refresh-a-captcha-without-refreshing-the-page/9395/8 "2017-01-09T21:46:33Z")

</div>

The same user makes many data entry in a row on the same page , he validates the captcha first time… and then? I want him to validate for any entry, that’s why I need to reset and restore the captcha to use it again on the same page.

otherwise a human would be able to sblock the captcha the firt time and then leave the job to a robot to produce a million entries… that’s what I want to avoid btw

the code I talked about is provided by google, just need to apply it to our environment where the captcha is provided by the bubble plugin…

---

<div class="post-metadata">

**Author:** ![mishav](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mishav/32/6420_2.png) [@mishav](https://forum.bubble.io/u/mishav)\
**Post date:** [January 11, 2017, 6:43am UTC](https://forum.bubble.io/t/refresh-a-captcha-without-refreshing-the-page/9395/9 "2017-01-11T06:43:24Z")

</div>

The challenging part is getting the javascript function to run just when you want it to, and not any other time. Here is one way to do it.

1: Create a HTML element with the javascript in it (see screenshot for indenting):

> `<script type="text/javascript"> if("mycustomstate" === "yes") { if(typeof grecaptcha !== 'undefined' && grecaptcha && grecaptcha.reset) { grecaptcha.reset(); } } </script>`

This script will run at page load, so it has a check on the grecaptcha reset function being defined. It has another check which is explained later.

2: Create a yes/no custom state, use a workflow action to set it to “yes”, delay a bit to allow the javascript to run, then set it back to “no”. I picked 100ms delay.  
 ![](https://us1.discourse-cdn.com/bubble/original/2X/4/40e33e7b33b2d3987f2a2bee645a754453751151.png)

3: Back to the HTML element, replace the `mycustomstate` with a dynamic value.  
 ![](https://us1.discourse-cdn.com/bubble/original/2X/5/541fb3c13f30992f3acf145630787aef1587a13c.png)  
becomes:  
 ![](https://us1.discourse-cdn.com/bubble/original/2X/4/4854f0d5e8f8625ca02eeb09a6bf20f397c2edc7.png)

What happens is, whenever the custom state changes value, the entire javascript is rerun, but the reset function only runs if the value changes to “yes”.

For a more robust method, you could store the current time ms in the custom state instead, and get the javascript to compare it to the last time it received a reset request.

Edit: You’ll find that the HTML element has to be “visible” for the javascript to run, but there are other ways of hiding it from display.

---

<div class="post-metadata">

**Author:** ![rhinoted](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/rhinoted/32/8352_2.png) [@rhinoted](https://forum.bubble.io/u/rhinoted)\
**Post date:** [January 12, 2017, 9:10am UTC](https://forum.bubble.io/t/refresh-a-captcha-without-refreshing-the-page/9395/10 "2017-01-12T09:10:51Z")

</div>

thank you! I will work on that 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/bubble/original/3X/2/8/2847faa74692c2ffa5d939d3dc3724cdd060d247.png) [@system](https://forum.bubble.io/u/system)\
**Post date:** [March 20, 2017, 3:44pm UTC](https://forum.bubble.io/t/refresh-a-captcha-without-refreshing-the-page/9395/11 "2017-03-20T15:44:48Z")

</div>

This topic was automatically closed after 70 days. New replies are no longer allowed.
