Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

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


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

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".


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(