Is it possible to clear the validation state of the form programmatically?
Use-case: I have a form with conditional fields that are controlled via a select, if you choose option1 and submit without a value it creates a validation error on fieldA, if you choose option2 it shows fieldB, the form validation is still success: false due to the previous submission.
Ideally, when switching between fields/schemas I'd like to clear the validation that was done previously.
Calling zo.validate() isn't ideal as that means all of the fields will then be validated, rather than being clean/fresh.
Perhaps a resetValidation or validationReset could be added here?
const validationReset = useCallback(() => {
setValidation(null);
}, []);
Perhaps it could be zo.validate({ reset: true }) or something similar if the above option isn't ideal?
Is it possible to clear the validation state of the form programmatically?
Use-case: I have a form with conditional fields that are controlled via a select, if you choose
option1and submit without a value it creates a validation error onfieldA, if you chooseoption2it showsfieldB, the form validation is stillsuccess: falsedue to the previous submission.Ideally, when switching between fields/schemas I'd like to clear the validation that was done previously.
Calling
zo.validate()isn't ideal as that means all of the fields will then be validated, rather than being clean/fresh.Perhaps a
resetValidationorvalidationResetcould be added here?Perhaps it could be
zo.validate({ reset: true })or something similar if the above option isn't ideal?