How to detect form changes. #4064
Replies: 6 comments 7 replies
-
https://react-hook-form.com/api#formState dirtyFields, dirty |
Beta Was this translation helpful? Give feedback.
-
Hello, I have a different need that requires constant watching of a field value (array entries) in order to change another field value (another array). I want to populate the 2nd array based on the 1st array, i.e. if I add a 3rd item in 1st array I want to The How can we do this? |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
once the value is changed, isDirty will always be true because it tracks the previous defaultValues not the updated one. |
Beta Was this translation helpful? Give feedback.
-
import { isEqual } from "lodash"; const { formState, getValues } = useFormContext(); |
Beta Was this translation helpful? Give feedback.
-
I had good luck with this approach:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a form which the inputs are prepopulated with data, how do I detect whether a user has already changed the input values or not?
What I wanted to achieve is that I want to disable the submit button if a user has not changed any input values of the form, while enable the submit button if a user has changed the form values.
Any advice would be much appreciated🙏
Beta Was this translation helpful? Give feedback.
All reactions