I can't change the initial checkbox state to unchecked in a Wizard multi-step form
Hello,
I can't change the initial checkbox state to unchecked in a Wizard multi-step form. It seems the component only accept "checked" as an initial state and I'd like to setup "unchecked".
Is this a bug in the component or am I doing something wrong?
Thansk,
MB
Replies (2)
Elements must be "unchecked" by default.
Set a type value to "checkbox" and the value attribute should represent value that you want to select with this checkbox.
<Field
class="form-check-input"
type="checkbox"
name="fieldName"
value="3"
/>
In formData add a property with your field name with type string[] and set array which will contain values of "checked" input fields.
const formData = ref<CreateAccount>({
...
fieldName: ["1", "3"],
...
});
Input fields from the array will be "checked", and other input fields with this name will be "unchecked".
Thank you!