How do I set the initial checked value of a checkbox? #4043
-
I'm trying to create a checkbox for agreeing to some terms, and in some instances I need to set the initial value to be checked. Using a native HTML input checkbox, I can use v-model to control whether or not the checkbox is checked. When using VeeValidate's Field component, using v-model does not change the checked status. Here is some sample code with two checkboxes illustrating the difference. How can I set the initial checked value for a VeeValidate Field checkbox? I've tried binding the checked property to a variable, but that has no effect.
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
|
Beta Was this translation helpful? Give feedback.
value="true"
sets the active value to a string with value "true". Try doing this instead::value="true"
which will make the field receive the boolean as a checked value.