final-form / final-form

🏁 Framework agnostic, high performance, subscription-based form state management

Home Page:https://final-form.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

resetFiled

dgalyan opened this issue · comments

Hi,

I am using resetFieldState function of useForm API to reset my field to the initial state. Unfortunately, it only resets a few fields and not reset the entire field object. The error state and invalid state are not updated to their default state i.e. error should be undefined and invalid should have false value. However, in my application, I want to update these fields to their default value. How can this functionality be achieved?

From what I understand, it only resets InternalFieldState and not InternalFormState.Whereas, the errors field is part of InternalFormState. So, how can I update errors state for given field?

Thanks

use restart to reset whole form fields and fields states

I'm in the same same situation - docs said Resets all of a field's flags (e.g. touched, visited, etc.) to their initial state. But not all fields in field-object are updated
use version
"final-form": "4.20.2",
"react-final-form": "6.5.3",

@dgalyan @mihanizm56 - Please provide a CodeSandbox to demonstrate the bug