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

Removing all fields may cause empty form to be invalid #485

Open
varzager opened this issue Oct 22, 2017 · 1 comment
Open

Removing all fields may cause empty form to be invalid #485

varzager opened this issue Oct 22, 2017 · 1 comment

Comments

@varzager
Copy link

I have a scenario that i have a form with a few inputs, and 1 input is invalid.
Then i remove ALL inputs from the form.
and the form stays invalid, even though it is empty => valid.
I think this happens is because Formsy runs validation only when it has at least one input.

It seems the function validateForm in main.js validates only forms that contain at least 1 input.

I believe adding isValid: true, would fix that:

if (!this.inputs.length) {
      this.setState({
        canChange: true,
        isValid: true,
      });
    }

What do u think?

Thanks

@rkuykendall
Copy link

This is an interesting issue. If you're still interested, can you re-create it in the new formsy organization? https://github.com/formsy/formsy-react

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

No branches or pull requests

2 participants