Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A global isPristine #597

Open
adsee42 opened this issue Dec 24, 2020 · 3 comments
Open

A global isPristine #597

adsee42 opened this issue Dec 24, 2020 · 3 comments

Comments

@adsee42
Copy link

adsee42 commented Dec 24, 2020

I have a reset button for the form; and I would like to disable the button is the form is already reset to initial values.

There is a isPristine property for one single field. Is there a global property / function to check if the whole form is not "touched"?

@rkuykendall
Copy link
Member

rkuykendall commented Dec 28, 2020

There is not, but it looks like it would be very easy to write in Formsy.ts. Something like this, I think:

  public get isPristine = () => {
    return this.inputs.every((component) => component.state.isPristine);
  };

Would you like to try to add it, write a test, and add it to the documentation?

@adsee42
Copy link
Author

adsee42 commented Jan 28, 2021

I would love to. but I just got started with ts, and currently filled with works😢

But I'm very happy to give it a try after April, if that's ok.

@rkuykendall
Copy link
Member

Totally! I also added the (pull request wanted) tag so it might get done by myself or someone else. Whoever does it, thanks for the great suggestion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants