[Zope3-Users] Vocabularies and deleted values

Douglas Cerna douglascerna at yahoo.com
Fri Sep 21 19:54:39 EDT 2007


Hi everyone.

I have setup a SimpleVocabulary that extracts its
values from a Persistent object with a List attribute
(kind like Philip's book example in Chapter 17). I
also defined other object that uses the vocabulary in
Choice field. It works.

I can add and delete values from the Persistent object
and the changes are reflected in the <select> element
generated from the vocabulary.

But if I delete a value already assigned to an object
I want my <select> element to show a (no value) option
(like the one used if a Choice field is not required)
if I edit that object.

I found a post in "Re: Required choice without default
value in formlib" by Stephan:

"""
You would have to write your own widget that displays
a blank value by 
default. If the blank value is not changed by the user
to a real value, then 
the widget throws an error during validation.

I think by mapping the blank value to the missing
value willdo the trick, so 
the custom widget would be a simple extension to the
existing one.
"""

but I don't know how to create a custom widget like
that.

I'd appreciate any advice on this. Thanks.


      ____________________________________________________________________________________
Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 




More information about the Zope3-users mailing list