zopyx
(Andreas Jung)
February 20, 2020, 1:31pm
1
We have a zope.schema.Bool
in a supermodel XML with title and description field.
Using <form:widget type="z3c.form.browser.checkbox.CheckBoxFieldWidget">
renders the two checkboxes yes
and no
.
Using <form:widget type="z3c.form.browser.checkbox.SingleCheckBoxFieldWidget">
renders a single checkbox (OK!) but the description is completely omitted
Anything missing here?
1letter
(Jan)
February 20, 2020, 5:50pm
2
No, i think thats the default behavior. register your own subclassed widget, shoot with cannons on sparrows.
fredvd
(Fred van Dijk)
February 21, 2020, 2:22pm
4
Isn't it the label which is set to empty in the code of the SingleCheckBoxFieldWidget?
@zope.component.adapter(zope.schema.interfaces.IBool, interfaces.IFormLayer)
@zope.interface.implementer(interfaces.IFieldWidget)
def SingleCheckBoxFieldWidget(field, request):
"""IFieldWidget factory for CheckBoxWidget."""
widget = FieldWidget(field, SingleCheckBoxWidget(request))
widget.label = u'' # don't show the label twice
return widget
Reading the comment the assumption is that the label is already displayed by another part of the template.
mtrebron
(Norbert )
February 22, 2020, 10:15am
5
I also once crossed that bridge:
<field name="farbtone_series" type="zope.schema.Bool" lingua:independent="true">
<title>Farbtöne Serien</title>
<description>Farbtöne in Serien anzeigen</description>
<default>False</default>
<required>False</required>
<!-- render as plain checkbox
<form:widget type="z3c.form.browser.radio.RadioFieldWidget" />
-->
</field>
You can leave out form widget to render:
The mangled list is apparently an artifact of @@ploneform-render-widget