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

Support for async validations #112

Open
mchurichi opened this issue Aug 10, 2018 · 9 comments
Open

Support for async validations #112

mchurichi opened this issue Aug 10, 2018 · 9 comments

Comments

@mchurichi
Copy link

Is there a declarative way to add custom async validations for an specific field?

I'm trying to add server side validations for an specific field that run whenever a field value changes and the suggested solution I found is allow the user to submit the whole form, validate it in the server side, return the result and use updateInputsWithError to set the errors in the input, if any. This could work well is not the best from the UX perspective.

Another solution I can think of could be use the onChange event on the Formsy wrapped component to dispatch the needed server side validation, but this sounds a bit hacky, and since formsy already has a great custom validations support would be wonderful if I can use that.

There is a PR (christianalfoni/formsy-react#408) in the old repo that was discarded because it uses Promises, but it's like 2 years old and things have changed since then.

Any thoughts?. Thanks.

@yantakus
Copy link

There's an open issue regarding this topic in the old repo: christianalfoni/formsy-react#261

@yantakus
Copy link

@mchurichi I see a long time passed since you opened this issue. Any luck with this? I like formsy-react and wouldn't like to migrate to another solution just because of this.

@mchurichi
Copy link
Author

@yantakus sorry for the late response, no luck with this issue, I used the second workaround mentioned in my first comment, which is a bit hacky, but it works.

@LeoIannacone
Copy link

I can help update the code to the latest version if there's a wish to merge it.

@jabidof
Copy link

jabidof commented Jan 7, 2020

+1 feature needed.

@rkuykendall
Copy link
Member

The code is definitely far too different now, but the project is open to new PRs. I'm unsure of the feasibility of this, but it could be as easy as some async and awaits in the right places. @jabidof I recommend adding 👍 to the top comment since that's a common way of showing support for a feature.

@rkuykendall
Copy link
Member

Unfinished and out of date PR, but useful reference for anyone who wants to take this on: #340

@rkuykendall rkuykendall changed the title Support for async validations? Support for async validations Feb 22, 2020
@1aerostorm
Copy link

1aerostorm commented Apr 3, 2021

Not yet implemented?

NEEDED!

May be I can help.

@rkuykendall
Copy link
Member

Yes, you probably can @1aerostorm. Please feel free to open a PR. If you have any questions I would happily answer them.

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

7 participants