[Zope] tal:attributes and onClick

J Cameron Cooper zope-l at jcameroncooper.com
Mon Oct 4 15:32:47 EDT 2004


Laura McCord wrote:
> I think I didn't explain this right. I need to define 'info' as an
> onclick operation. I need more than one onclick attribute, one for
> defining info and the other to call string:expandIt('$resString}';;. but
> I think I can not do -> info python:here.userInfo(username) in an
> onclick. I think someone told me before that you cannot call zope
> functions directly like this from an onclick, I would have to use a
> javascript function. If this is so, I am not sure how to call a zope
> function from a javascript function. Plus, I need info to be global.

I'm not quite sure what you want to do, but I have a feeling you're 
mixing modes. Remember that to Zope Javascript is just text, and that to 
Javascript (aka a browser) Zope is not visible at all (unless you use 
XML-RPC).

Do you mean to define 'info' as a Javascript variable? In which context 
should it be global?

		--jcc

> -----Original Message-----
> From: J Cameron Cooper [mailto:zope-l at jcameroncooper.com] 
> Sent: Monday, October 04, 2004 2:11 PM
> To: Laura McCord
> Cc: zope at zope.org
> Subject: Re: [Zope] tal:attributes and onClick
> 
> 
> Laura McCord wrote:
> 
>>The following code performs an expansion using the onClick.
>>
>>  <a href="#" tal:attributes="onClick 
>>string:expandIt('${resString}');; return false;">
>>          <IMG NAME="imEx" SRC="triUp2.gif" WIDTH=15 HEIGHT=15 
>>BORDER=0 ALT="Expand/Collapse Item">
>>  </A>
>>
>>Is there a way to add a tal:define on an onclick also? I need to 
>>define the following: tal:define="info python:here.userInfo(username)"
> 
> 
>>but I want it defined in the on onclick as well.
> 
> 
> A TAL define statement, as you can see in the order of operations 
> section of the docs, is in scope for other statements in the same
> element.
> 
> In other words, you can do your define and simply use 'info' in your 
> attributes statement. Are you experiencing anything else?
> 
> 		--jcc
> 
> 



More information about the Zope mailing list