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
When using an individual checkbox (non-array) with a default value of true, the resetForm() method will always set the checkbox to the unchecked state.
This seems to be true no matter how the resetForm method is called. E.g. reset inside a <Form> component, resetForm({values:{checkField:true}}, resetForm().
Looking at the resetForm method, it looks like setValues/initialValues (Here or Here) sets the field to true as expected.
But when it calls resetField in applyFieldMutation (Here) it essentially toggles the field back off.
This issue seems to have been introduced in version 4.5.0.
Reproduction steps
Create a form with one or more single value checkboxes with an initial value of true.
Reset the form. Either passing a true value or empty (to use old initial values).
The text was updated successfully, but these errors were encountered:
gurudusty
changed the title
[v4] Individual checkboxes ignore initial value on formReset()
[v4.5] Individual checkboxes ignore initial value on formReset()
Oct 21, 2021
What happened?
When using an individual checkbox (non-array) with a default value of true, the
resetForm()
method will always set the checkbox to the unchecked state.This seems to be true no matter how the resetForm method is called. E.g. reset inside a
<Form>
component,resetForm({values:{checkField:true}}
,resetForm()
.Looking at the resetForm method, it looks like setValues/initialValues (Here or Here) sets the field to true as expected.
But when it calls resetField in applyFieldMutation (Here) it essentially toggles the field back off.
This issue seems to have been introduced in version 4.5.0.
Reproduction steps
Version
Vue.js 3.x and vee-validate 4.x
What browsers are you seeing the problem on?
Relevant log output
No response
Demo link
https://codepen.io/dusion/pen/zYdooKj
Code of Conduct
The text was updated successfully, but these errors were encountered: