question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onChange breaks after reset

See original GitHub issue

run grecaptcha.reset() and then the onChange event doesn’t work anymore.

You could need to bind everything after the reset

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
stiofandcommented, Sep 15, 2017

I’m trying to get my Recaptcha component to reset, based on a redux store dispatch, but none of the reset examples here apply to a ReCaptcha component. I have no idea what this grecaptcha example is. Is there somewhere I can see a less convoluted reset example of the actual React Element being reset???

const ReCaptchaBox = ({dispatch, shouldReset})=> {

 if(shouldReset){
   // Reset captcha??
  // Possible return new ReCaptcha as per Sawtaytoes example?
}

return(
    <ReCAPTCHA
      className="recaptcha-box"
      name="recaptcha"
      sitekey={AppProperties.googleReCaptchaKey}
      size="normal"
      onChange={r => sendRecaptchaVerificationRequest(dispatch, r)}/>
  );
};

export default connect(state=>({
  shouldReset: state.recaptcha.shouldReset
}))(ReCaptchaBox);

Then in code,

<ApplicationForm>
    .....
    <ReCaptchaBox />
</ApplicationForm >

My solution would be for another element (any redux connected element to fire of a RESET_RECAPTCHA or similar, which would update the store, and thus the recaptcha would reset:

I cant see any possible solutions so far.

0reactions
Sawtaytoescommented, Sep 10, 2021

@srvsankpal In my particular case, it’s been years, and I don’t work at the company where I was doing it.

I did use reCAPTCHA on a recent project and built it in myself rather than using a 3rd party library. Possibly not helpful, but it’s an alternative to consider since this library is also just using their JS API.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resetting a form does not fire `onChange` · Issue #858 - GitHub
Change the "First Name" field to see the onChange event called. Then, click the button to reset the form. Observe that onChange is...
Read more >
React input value getting reset to initial state after onChange ...
I am having an issue where I have an input to update based a user editing the current value. However, the value gets...
Read more >
onchange Event - W3Schools
The onchange event occurs when the value of an element has been changed. For radiobuttons and checkboxes, the onchange event occurs when the...
Read more >
Preserving and Resetting State - React 中文文档
You can control when to preserve state and when to reset it between ... Take a break ... Currently, when you change the...
Read more >
Windows 10 Remote users certifcates invalid after password ...
After user change domain password, there's a validation error for User ... as there was a history of an Update breaking the certificate....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found