JSONForms icon indicating copy to clipboard operation
JSONForms copied to clipboard

Checkbox values are ignored

Open tflori opened this issue 8 years ago • 0 comments

<input type="checkbox" name="emails[]" value="1" checked />
<input type="checkbox" name="emails[]" value="2" />
<input type="checkbox" name="emails[]" value="3" checked />

For me this should result in this:

{
  "emails": [
    1,
    3
  ]
}

But currently it gets:

{
  "emails": [
    true,
    false,
    true
  ]
}

My workaround is:

<input type="checkbox" name="emailSelected[1]" value="true" checked />
<input type="checkbox" name="emailSelected[2]" value="true" />
<input type="checkbox" name="emailSelected[3]" value="true" checked />

Which results in:

{
  "emailSelected": {
    "1": true,
    "2": false,
    "3": true
  }
}

tflori avatar Mar 13 '17 16:03 tflori