caolan / caolan/forms

simple checkbox

Open
#206 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1k
Forks
161
PR merge metrics
No merged PRs in 30d

Description

I am trying to get a simple single checkbox to work. I can't get the `value` to work. The two closest approaches are have found are *array/multipleCheckbox* and *string/checkbox*. However, neither is quite what I want. Here is the javascript:

```javascript
blue: fields.array({
choices: { one: 'item 1' },
widget: widgets.multipleCheckbox()
}),
green: fields.string({
value: 'abc',
widget: widgets.checkbox()
}),
```
and the resulting HTML:
```html



Blue


item 1




Green


```
Using the *array/multipleCheckbox* I actually get the `` code I want. It has the correctly set `value`, but it is wrapped in an unwanted ``.

The other version using *string/checkbox* doesn't have the `` but the `value` incorrectly set to "on".

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.