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

Add isValidating by field #5744

Closed
taily-khucnaykhongquantrong opened this issue Jun 26, 2021 · 9 comments
Closed

Add isValidating by field #5744

taily-khucnaykhongquantrong opened this issue Jun 26, 2021 · 9 comments
Labels
feature request request a feature to be added

Comments

@taily-khucnaykhongquantrong
Copy link

Is your feature request related to a problem? Please describe.
I implement a spinner when the field is validating. I use isValidating from formState and this will trigger loading for every fields.

Describe the solution you'd like
We need isValidating from fieldState the same as isDirty, it could be trigger by field, and we should have isValidatingFields in case of we don't use Controller.

Describe alternatives you've considered
At the moment, I have to use trigger and implement isValidatingFields using React State. When I manually trigger the validation, I will setState the field.

Additional context
This is my UI screenshot when doing this feature.
image

@bluebill1049
Copy link
Member

thanks for the feature request.

I would recommend using:

  • useFormState at your component level
  • useController (like what you suggested) above.

i will still ping this feature on our feature board for sometimes, see if other users have similar requests.

@bluebill1049 bluebill1049 added feature request request a feature to be added waiting-up-vote Waiting for votes from the community. labels Jun 26, 2021
@bluebill1049 bluebill1049 added this to Pending Feature Requests in React Hook Form Jun 26, 2021
@davbrito
Copy link

davbrito commented Sep 7, 2021

This is a feature that I definitely would like to see in RHF soon. 👍🏽

@bluebill1049
Copy link
Member

thanks, @davbrito thinking about this, would it be easier to host a local state (i guess if you are using useController hook).

@bluebill1049 bluebill1049 removed the waiting-up-vote Waiting for votes from the community. label Dec 14, 2021
@bluebill1049 bluebill1049 removed this from Pending Feature Requests in React Hook Form Dec 14, 2021
@konarssuresh
Copy link

thanks, @davbrito thinking about this, would it be easier to host a local state (i guess if you are using useController hook).

There is a similar use case in my project . @bluebill1049 . Can you show me a example how to do it using useController and state.
Will isValidating prop be added at fieldState in useController ?

@nathanqg
Copy link

nathanqg commented Apr 9, 2022

@konarssuresh did you manage to solve this? I'm also looking for a way to display the validation status per field.

@thenano
Copy link

thenano commented May 26, 2022

I would also love this feature.
In my case, I use a yup schema with the yup resolver and an async api call to validate the field (specifically we check if the handle is available or not). I want to explicitly set a message below the field only when that field is validating, not when the rest of the form is validating, and since yup handles the validation it's pretty tricky to add this as a local state.

@kyledevans
Copy link

kyledevans commented May 26, 2022

Was this feature added? I see a couple bugs that are asking for this that have been closed, but I don't see how this can be accomplished.

EDIT:
I'm using the <Controller /> component. Though I can convert to useController if necessary, it's not my first choice.

@ghost
Copy link

ghost commented Aug 31, 2022

this is good feature if we are dealing with multiple asynchronous form , either way it might cause pending ui to appear on another input , it would be great if you add this feature

@MatthewTang
Copy link

Another vote for this feature! Thanks a lot, really like this library!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature request request a feature to be added
Projects
None yet
Development

No branches or pull requests

8 participants