Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simple checkbox #206

Open
leejoramo-d51 opened this issue Sep 14, 2018 · 1 comment
Open

simple checkbox #206

leejoramo-d51 opened this issue Sep 14, 2018 · 1 comment

Comments

@leejoramo-d51
Copy link

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".

@ljharb
Copy link
Collaborator

ljharb commented Sep 21, 2021

Why don't you want the fieldset there?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants