Closed mauserzjeh closed 4 weeks ago
Hmm. I think I struggled with similar issue today, as I had zod schema with z.string().date()
added with some .default
date.
After clearing the input it somehow still had that initial default value in state and proceeded with submission although the input was empty!
But in your case I am thinking why do you use "reset" to set new values, which you didn't even initially have.
Wouldn't just setting the field value be better? Though not sure if that makes any difference in the end... useSetFieldValue
is available from https://github.com/logaretm/vee-validate/pull/4397 .
Can you please add a minimal reproduction?
@Snurppa If you provide defaults to the schema it will stay there since it will always be available for the validators. Usually using default
implies a field is optional. I don't think schema validators offer a way to not use the defaults defined with the schema, but at the same time that may not be an intended behavior to schema users if we just ignore defaults.
Scenario:
How can I avoid this? I want to trigger validation only on submit, but if a value was deleted it should retrigger the validation when I click submit again instead of passing
Example: