wearebraid / vue-formulate

⚡️ The easiest way to build forms with Vue.
https://vueformulate.com
MIT License
2.25k stars 243 forks source link

Initial values for checkboxes in schema are not set on form submission #483

Open hisuwh opened 3 years ago

hisuwh commented 3 years ago

Describe the bug Creating a form using a json schema with checkboxes with initial value does not set initial value on form submission.

Reproduction https://codepen.io/hisuwh/pen/powJJex

Expected behavior All initial values should be in form submission.

Note: it seems to work as expected for text inputs

Screenshots

image

Device information:

hisuwh commented 3 years ago

Think I've got a fix. Will send a PR

hisuwh commented 3 years ago

Seems there is also a workaround by setting value as well as checked:

const schema = [
  {
    type: "checkbox",
    name: "myInput",
    label: "My Checkbox",
    checked: true,
    value: true
  }
  ...
]