[Zope3-Users] Selecting a Vocabulary for a Choice field upon the value of another field

Massimiliano della Rovere massimiliano.dellarovere at gmail.com
Fri May 1 07:57:28 EDT 2009


Greetings,
I'm presented with the following situation:
I am creating a schema for a wine degustation.
One of the the fields describing the wine, the colour of the wine
(field: wine_colour), is implemented like a Choice field.
Red, white and roseé wines (field: wine_type) have different possible
shades of colour and I have one vocabulary devoted to each kind of
wine.
Now my problem:
During the editing of the schema, I need the right vocabulary
(shades_red, shades_white, shades_rosee) to be linked as source for
the Choice field (or the <option> items to populate the <select> tag
int he html page if you prefer) and the wine_type of the schema tells
me which vocubulary to use.
This is a dynamic bind.

I imagined 3 possible solutions:
1) list the content of each vocabulary in a separate <select> field.
Then use a radiobutton group to "activate" a different choice (aka:
wine_colour). I do not like it because I want only one vocabulary o be
used.
2) split the schema into two pages: in the first page, and thus stage,
you define the wine colour, in the second the associated vocabulary is
used. I do not like it because I want all the data describing the
degustative experience in one page. This applies to page reloading
too.
3) javascript: when the user selects one value for of the wine_colour,
using javascript I modifiy the <option> items in the <select> tag. I
do not like it because it seems to me rather messy, like putting
inline assembly code in a C++ program :)

Is there a more elegant way I am not aware of? what do you suggest me?
the ideal solution would be something like the TActiveControls of
Prado: http://www.pradosoft.com/demos/quickstart/?page=ActiveControls.Home
Is there anything like that in Zope (as 3rd party lib maybe)?

Thanks


More information about the Zope3-users mailing list