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.

Reset form after valid submit

See original GitHub issue

Hello! I tried to follow this https://github.com/christianalfoni/formsy-react/blob/master/examples/reset-values/app.js but to run function reset after user changed his password - but that doesn’t work I think in this example <button type="reset" manage action - not function onClick={this.resetForm}

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:3
  • Comments:9

github_iconTop GitHub Comments

6reactions
hak11commented, Jun 29, 2017

i have same issue, and I fix it like this

submitForm(data) {
  alert(JSON.stringify(data, null, 4));
  this.areaForm.reset();
}

resetForm() {
  this.areaForm.reset();
}

       
render () {
  return (
      <Formsy.Form
        ref={(event) => { this.areaForm = event; }}
        onValid={this.enableButton}
        onInvalid={this.disableButton}
        onValidSubmit={this.submitForm}
        onInvalidSubmit={this.notifyFormError}
      >
        .................
        .................
       <RaisedButton
          primary={true}
          style={{marginTop: 32}}
          type="submit"
          label="Simpan"
          disabled={!this.state.canSubmit}
          value={this.state.nameForm}
        />
        <RaisedButton
          secondary={true}
          onClick={this.resetForm}
          style={{marginTop: 32,marginLeft:32}}
          type="reset"
          label="Reset"
          value={this.state.nameForm}
        />
      </Formsy.Form>
2reactions
jarussi-luizalabscommented, Sep 13, 2016

same here! anyone found a solution for this?

Also … the link on the first post is incorrect … the correct one is https://github.com/christianalfoni/formsy-react/blob/master/examples/reset-values/app.js

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to reset form validation on submission of the form in ...
To make the form empty call this.contactForm.reset(); and the form will be invalid , it's fine. However, you also need to reset the...
Read more >
Reset Validation On An Angular Form
Some forms require the ability to “clear” all input and “reset” the form. I struggled through a few different ways of clearing a...
Read more >
Reset form after form submission succeed · Issue #21 · final ...
reset () clears the form, then runs validation. I found it's better to call form.restart() because it doesn't run validation. An example use...
Read more >
Reactive Form - Reset input validation after change
When 'Built-In Validations=Yes' then OutSystems will automatically check and *reset* each field's .Valid field according to the Mandatory fields and correct ...
Read more >
To reset a form or to resetForm?
A common scenario when you want to submit a form is to enable/disable the submit button according to the validation of form fields....
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