forms
forms copied to clipboard
simple checkbox
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:
blue: fields.array({
choices: { one: 'item 1' },
widget: widgets.multipleCheckbox()
}),
green: fields.string({
value: 'abc',
widget: widgets.checkbox()
}),
and the resulting HTML:
<div class="field">
<fieldset>
<legend>Blue</legend>
<input type="checkbox" name="blue" id="id_blue_one" value="one" />
<label for="id_blue_one">
item 1
</label>
</fieldset>
</div>
<div class="field">
<label for="id_green">Green</label>
<input type="checkbox" name="green" id="id_green" value="on" />
</div>
Using the array/multipleCheckbox I actually get the <input>
code I want. It has the correctly set value
, but it is wrapped in an unwanted <fieldset>
.
The other version using string/checkbox doesn't have the <fieldset>
but the value
incorrectly set to "on".
Why don't you want the fieldset there?