vue-formulate icon indicating copy to clipboard operation
vue-formulate copied to clipboard

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

Open hisuwh opened this issue 2 years ago • 2 comments

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:

  • Device: Windows 10 PC
  • OS: Windows 10
  • Browser Google Chrome
  • Version 92.0.4515.159

hisuwh avatar Aug 26 '21 10:08 hisuwh

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

hisuwh avatar Aug 26 '21 12:08 hisuwh

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
  }
  ...
]

hisuwh avatar Aug 26 '21 12:08 hisuwh