[Zope] Re: How to do this trick..

Michael Haubenwallner michael at d2m.at
Tue Mar 28 00:45:09 EST 2006


Jason C. Leach wrote:
 > Hi,
 >
 > I'm wondering how I can do this little trick (sp_info is a globaly devide
 > var, it's a dictionary obj):
 >
 >             <option tal:repeat="group groups/existing/high"
 >                 tal:content="group"
 >                 tal:attributes="onmouseover string:doTooltip(event,
 > '${sp_info/${group}/common_name}')"
 >                onmouseout="hideTip()">
 >             </option>
 >
 > So based on my the value of 'group' from my repeat, I want to use the 
value
 > to look up another value in a different dictionary.  It works if I do 
this:
 > (event, '${sp_info/whatever/common_name}') but does not like me using the
 > embedded ${group}.
 >

You can insert the value of a dynamically named variable using the '?' 
specifier::

                  tal:attributes="onmouseover string:doTooltip(event,
  '${sp_info/?group/common_name}')"

should do the trick. This only works inside path expressions.

Hth, Michael

-- 
http://zope.org/Members/d2m
http://planetzope.org



More information about the Zope mailing list