I ran into the exact same problem and don't know if there's a fix or work around by now but if ordering doesn't matter, you could try schema.Set
(or schema.FrozenSet
) instead of schema.List
. These all let you select multiple options. I've tested the Set
options and they both work with the mode
as hidden
.
(1) Set/FrozenSet
field = zope.schema.Set(
value_type=zope.schema.Choice(values=(1, 2, 3, 4)),
default=set([1, 3]) )
widget = setupWidget(field)
widget.update()
widget.__class__
<class 'z3c.form.browser.select.SelectWidget'>
select widget: allows you to select one or more values from a set of given options
(2) List
field = zope.schema.List(
value_type=zope.schema.Choice(values=(1, 2, 3, 4)),
default=[1, 3] )
widget = setupWidget(field)
widget.update()
widget.__class__
<class 'z3c.form.browser.orderedselect.OrderedSelectWidget'>
ordered-select: allows you to select one or more values from a set of given options and sort those options.