[Zope] (newbie)-Calling in Multiple Selection from a Z-Class

Ben beninisrael at hotmail.com
Wed Dec 17 17:13:04 EST 2003


# I have a Z-Class called animals with a multiple selection for animal_catagories
# I call in each member of the Z-class:

<dtml-with AnimalDirectory>
  <dtml-in expr="objectValues()">
   <dtml-if "meta_type==' Animal">

# For testing:

<dtml-var id> has <dtml-var animal_catagories>

# Which gives me "Horse is ['hooved','brown','horsey'] as these are the values that I have given to the horse instance
# I then have:

        <dtml-if expr="REQUEST['hooved'] == _['animal_categories'][0]">
                <dtml-var id> is a  <dtml-var hooved> animal
                       </dtml-if>
 
# Which gives me  Horse is a hooved animal. Which is great!
# Except this is only checking for the first value. If hooved were the second value chosen in the multiple select list, then this would not show. This is obvious because of the [0]
# What I am trying to do is to compare hooved with each of the animal categories to see if it has been chosen. If I use a  <dtml-in animal_catagories> with or without ''s, then it tells me that I can't call in a string. 
# Could anyone please help me, or point me in the right direction? 

Thanks,

Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20031218/a0ba35d7/attachment.html


More information about the Zope mailing list