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.

How to restart the form?

See original GitHub issue

For example after the onValidSubmit={} have been fired.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

5reactions
TheSharpieOnecommented, Jun 23, 2017

You can get the ref from AvForm and use reset()

class Whatever extends React.Component {
  constructor(props){
    super(props);
    this.handleValidSubmission = this.handleValidSubmission.bind(this);
  }
  
  handleValidSubmission (event, fields) {
    //  do your thing
    this.form && this.form.reset();
  }

  render() {
    return (
      <AvForm onValidSubmit={this.handleValidSubmission} ref={c => (this.form = c)}>
        ...
        Your form fields here
        ...
      </AvForm
    )
  }
}
0reactions
diegodesouzacommented, Apr 1, 2020

@TheSharpieOne I’d like to have access to any field and not yet reset the whole form, I’ve seen the context part, but get undefined when placing a break point on it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I restart my C# WinForm Application? - Stack Overflow
It's simple, you just need to call the Application.Restart() method, this will invoke your application ...
Read more >
HTML DOM Form reset() Method - W3Schools
The reset() method resets the values of all elements in a form (same as clicking the Reset button). Tip: Use the submit() method...
Read more >
HTMLFormElement.reset() - Web APIs | MDN
The HTMLFormElement.reset() method restores a form element's default values. This method does the same thing as clicking the form's <input ...
Read more >
How to reset or clear a form using JavaScript? - Tutorialspoint
The reset() function is defined in JavaScript and by just clicking on it the form which will be linked to its onclick() method...
Read more >
Application.Restart Method (System.Windows.Forms)
The most common reason for calling Restart is to start a new version of the application that you have downloaded through ClickOnce using...
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