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

SingleCheckboxWidget checked state not saved without value=selected #101

Open
thet opened this issue Mar 22, 2021 · 2 comments
Open

SingleCheckboxWidget checked state not saved without value=selected #101

thet opened this issue Mar 22, 2021 · 2 comments
Labels

Comments

@thet
Copy link
Member

thet commented Mar 22, 2021

What I did:

I had a field which uses a z3c.form SingleCheckboxWidget. Field definition:

    some_bool = zope.schema.Bool(
        title="some title",
        required=False,
        default=False,
    )

And this was the manually set HTML code for the checkbox:

    <input name="some_bool" type="checkbox" />

What I expect to happen:

Saving the form with a checked checkbox should have resulted in a set boolean for the object.

What actually happened:

The boolean was not set because:

    <input name="some_bool" type="checkbox" value="selected" />

I'd have expected that a <input name="some_bool" type="checkbox"/> as a prototypical representation of booleans in html forms to just work out of the box.

I suggest to also add the term on to

vocabulary.SimpleTerm('selected', 'selected',

Not sure, but I guess that would solve the issue...

What version of Python and Zope/Addons I am using:

  • Ubuntu 20.04.1
  • Python 3.8.5
  • z3c.form-3.7.1-py3.8.egg
  • Zope-4.5.5-py3.8.egg
  • Products.CMFPlone-5.2.4-py3.8.egg
@d-maurer
Copy link
Contributor

d-maurer commented Mar 23, 2021 via email

@icemac
Copy link
Member

icemac commented Mar 23, 2021

@thet Did Dieter's explanation solve your problem, so the issue can be closed?

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

No branches or pull requests

3 participants