You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi guys,
I'm trying to disable a field (actually a button) if some other fields are invalid.
Using the watch function only ensures that the field's content is not empty.
Are you familiar with a better option that ensures that any of the required validations (pattern, min, max etc.) are valid?
I found an alternative way - to check if there is an error using the errors object that is exposed by the formState
See an example in this Stackblitz project - https://stackblitz.com/edit/react-hook-form-example-ry53tf?file=index.tsx
But there is still a problem so if the input is not dirty, there are no errors..
Is there a better option?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi guys,
I'm trying to disable a field (actually a button) if some other fields are invalid.
Using the watch function only ensures that the field's content is not empty.
Are you familiar with a better option that ensures that any of the required validations (pattern, min, max etc.) are valid?
I found an alternative way - to check if there is an error using the errors object that is exposed by the formState
See an example in this Stackblitz project - https://stackblitz.com/edit/react-hook-form-example-ry53tf?file=index.tsx
But there is still a problem so if the input is not dirty, there are no errors..
Is there a better option?
Beta Was this translation helpful? Give feedback.
All reactions