atapi.StringField('floor',
required = False,
vocabulary = ['one','two','three']
widget = atapi.SelectionWidget(
label = _(u"Floor"),
type = 'radio',
),
)
for type=='radio' i get five options, no option is chosen. submitting the
form w/o touching the widget will result in context.floor == ''::
[] one
[] two
[] three
for type=='select' i get a pulldown with 'one' pre-selected. submitting the
form w/o touching this widget results in context.floor=='one'
To use a pulldown w/o having 'one' set by default i'd need to define
vocabulary = ['','one','two','three']
which would result in a useless selectable value in case we switch back to
type=='radio'
Is there a _good_ reason archetype's selectionwidget does not automatically
add an empty choice if required==False and type=='select'???
How did other people work around this problem (i'm sure i'm not the first
one struggling with this)?
regards, fRiSi
--
Webmeisterei GmbH - Büro für Netzfragen
Tel: +43 5572 908877, Fax: +43 5572 908877-66
Steinebach 18, A-6850 Dornbirn
http://www.webmeisterei.com
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Plone-Users mailing list
Plone...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plone-users
I'd call it a bug.
In ATExtensions I work around this by having an optional
argument to 'getDisplayList' (defined in there) which I
use as a basis for controlled vocabularies managed in ZMI
to add the empty entry in front if needed.
Raphael
>
> atapi.StringField('floor',
> required = False,
> vocabulary = ['one','two','three']
> widget = atapi.SelectionWidget(
> label = _(u"Floor"),
> type = 'radio',
> ),
> )
>
>
> for type=='radio' i get five options, no option is chosen. submitting the
> form w/o touching the widget will result in context.floor == ''::
>
> [] one
> [] two
> [] three
>
>
> for type=='select' i get a pulldown with 'one' pre-selected. submitting the
> form w/o touching this widget results in context.floor=='one'
>
>
> To use a pulldown w/o having 'one' set by default i'd need to define
>
> vocabulary = ['','one','two','three']
>
> which would result in a useless selectable value in case we switch back to
> type=='radio'
>
>
> Is there a _good_ reason archetype's selectionwidget does not automatically
> add an empty choice if required==False and type=='select'???
>
> How did other people work around this problem (i'm sure i'm not the first
> one struggling with this)?
>
>
> regards, fRiSi
>
i submitted a bug (https://dev.plone.org/plone/ticket/9212) and will stick
with the
vocabulary = ['','one','two','three']
solution in the meantime..
regards, fRiSi
Raphael Ritz wrote:
--
Webmeisterei GmbH - Büro für Netzfragen
Tel: +43 5572 908877, Fax: +43 5572 908877-66
Steinebach 18, A-6850 Dornbirn
http://www.webmeisterei.com