Raphael Ritz wrote:
> Harald Friessnegger wrote:
>> When i define a StringField with an optional value using a
>> SelectionWidget i get two different behaviours depending on the type of
>> selectionwidget i use::
> 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
> --------------------------------------------------------------------------- ---
> 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
--