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

Small Business Services toolkit at magma.ca
Wed Dec 17 17:34:16 EST 2003


If you used property fields to implement the 'hooves' (and other) attributes, then you can use the hasProperty function to test if a given instance has 'hooves'

eg.  <dtml-if "animalinstance.hasProperty('hooves')">

Look in the API section of the Zope Book for more info.

P.S.   You can also check for meta types directly:

   <dtml-in "objectValues('Animal')">


HTH

Jonathan


  ----- Original Message ----- 
  From: Ben 
  To: zope at zope.org 
  Sent: December 17, 2003 5:13 PM
  Subject: [Zope] (newbie)-Calling in Multiple Selection from a Z-Class


  # 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
   


------------------------------------------------------------------------------


  _______________________________________________
  Zope maillist  -  Zope at zope.org
  http://mail.zope.org/mailman/listinfo/zope
  **   No cross posts or HTML encoding!  **
  (Related lists - 
   http://mail.zope.org/mailman/listinfo/zope-announce
   http://mail.zope.org/mailman/listinfo/zope-dev )

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20031217/888b3623/attachment.html


More information about the Zope mailing list