[Zope] passing ZPT variables to Javascript

Tonico Strasser contact_tonico@yahoo.de
Sat, 12 Oct 2002 19:10:56 +0200


Karen Yang schrieb:
> If I defined variables in my ZPT using tal:define, how do I pass these 
> variables to a javascript function without getting an error?
> 
> My attempt (obviously wrong):
>       <td tal:define="itemId item/id; code item/code">
>       <a style="color:dodgerblue"
>          tal:define="url 
> string:${request/URL1}/processDeleteItem?itemId:int=$itemId&code=$code"
>          href="javascript:doNothing()" 
> onClick="javascript:confirmDelete('string:$code', 'string:$url')"><img 
> src="/ItemManager/images/delete_icon" border="0"></a>
>       </td>
>      
> 
> Thanks,
> 
> Karen
> 
> 
> ------------------------------------------------------------------------
> Do you Yahoo!?
> Faith Hill <http://faith.yahoo.com> - Exclusive Performances, Videos, & more
> faith.yahoo.com <http://faith.yahoo.com>

Try it with tal:attributes, hera an example:

<a
  href="#"
  tal:define="code string:codeString; url string:urlString"
  tal:attributes="onClick string: javascript:alert('code: ${code} \nurl: ${url}')"
 >foo</a>

Tonico


-- 
Contact me
   mailto:contact_tonico@yahoo.de

Visit my HomePage
   http://tonico.freezope.org

__________________________________________________________________

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Yahoo! präsentiert als offizieller Sponsor das Fußball-Highlight des
Jahres: - http://www.FIFAworldcup.com