in Archetypes-based content types if a vocabulary used on a choice field has less than certain number of items (5, IIRC) the widget used is a radio button input instead of a select list.
in Dexterity-based content types there's no such behavior and the select list is always used.
is there any way to force a radio button input?
I tested the following but is not working and I can't find any documentation available:
from z3c.form.browser.radio import RadioWidget
class IMyType(form.Schema):
form.widget(my_field=RadioWidget)
my_field = schema.Choice(
title=_('My field'),
vocabulary=my_choices,
required=True,
)
I'm using Plone 4.2 and plone.autoform 1.3.
You can specify a custom widget like this in plone.autoform 1.4 and above.
In earlier versions of plone.autoform you need to specify a "field widget" (a callable that produces a widget when called) instead of a widget class. (plone.autoform 1.4 supports either one, and some other things covered in its documentation.) In this case you would use z3c.form.browser.radio.RadioFieldWidget.