[Zope] Re: javascript & zpt

Exteam exteam6@yahoo.co.in
Mon, 7 Jul 2003 15:17:12 +0100 (BST)


--0-114533063-1057587432=:98088
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit


hi jean
thanks for the response.but what will happened to the render part in the 
"replace -- with < & >

--input type="text" name="t1" 

tal:content="structure python:form.t1.render(t1)" size="10" value="0" /--

"
 this will bring the field t1 from the formulator .now when  i place the javascript attribute called addition(t1).it doesn't work.
i had actually written 
 

 

--input type="text" name="t1" 

tal:content="structure python:form.t1.render(t1)" size="10" value="0" /-- onchange="addition(t1.value,t2.value,t3)"--

--input type="text" name="t2" 

tal:content="structure python:form.t2.render(t2)" size="10" value="0" /-- onchange="addition(t1.value,t2,value,t3)"--

--input type="text" name="t3" 

tal:content="structure python:form.t3.render(t3)" size="10" --

t1,t2 (textfields )are defined in the formulator .

how do i make it work? I actually understand that after rnning a file that takes elements from the formulator, it names it as field_t1,field_t2,

is there any solution or alternative

my actual requirement is that , using the values entered in t1 & t2 i shud add them & put in the text box t3 also defined in the formulator .

my javascript function states that 

<script type="text/javascript">

function addition(arg1,arg2,arg3) 

{

var added = parseInt(arg1) + parseInt(arg2);

arg3.value = added;

}

plz help me

thanks

exteam

  Jean Jordaan &lt;jean@upfrontsystems.co.za&gt; wrote: Hi Exteam

In the footer of every mail from the zope lists, you may see this
sentence:

** No cross posts or HTML encoding! **

So please: no cross posts or HTML encoding.

Regarding your question. You send code like:

"""
                 t2 request/t2|nothing;
                 t3 request/t3|nothing">

 [input]  onchange="addition(t1.value,t2.value,t3)"
"""

It looks as though you want to use TAL-defined variables (t1, t2, t3)
in your javascript. This is how to do that:

"""
 [input]  onchange="replaced by TAL"
tal:attributes="onchange string:addition(${t1}.value,
${t2}.value,
${t3})"
"""

-- 
Jean Jordaan
http://www.upfrontsystems.co.za


_______________________________________________
Zope maillist - Zope@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 
SMS using the Yahoo! Messenger;Download latest version.
--0-114533063-1057587432=:98088
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

<P>hi jean
<P>thanks for the response.but what will happened to the render part in the 
<P>"replace -- with &lt; &amp; &gt;<FONT color=#0000c0 size=1></P><FONT color=#0000c0 size=1>
<P>--input type=</FONT><FONT color=#0000ff size=1>"text"</FONT><FONT color=#0000c0 size=1> name=</FONT><FONT color=#0000ff size=1>"t1"</FONT><FONT color=#0000c0 size=1> </FONT></P>
<P><FONT color=#0000c0 size=1>tal:content=</FONT><FONT color=#0000ff size=1>"structure python:form.t1.render(t1)"</FONT><FONT color=#0000c0 size=1> size=</FONT><FONT color=#0000ff size=1>"10"</FONT><FONT color=#0000c0 size=1> value=</FONT><FONT color=#0000ff size=1>"0"</FONT><FONT color=#0000c0 size=1> /--</P></FONT></FONT><FONT size=1>
<P></FONT>"
<P>&nbsp;this will bring the field t1 from the formulator .now when&nbsp; i place the javascript attribute called addition(t1).it doesn't work.
<P>i had actually written 
<P>&nbsp;</P><FONT color=#0000c0 size=1>
<P> </P>
<P>--input type=<FONT color=#0000ff size=1>"text"</FONT><FONT color=#0000c0 size=1> name=</FONT><FONT color=#0000ff size=1>"t1"</FONT><FONT color=#0000c0 size=1> </FONT></P>
<P><FONT color=#0000c0 size=1>tal:content=</FONT><FONT color=#0000ff size=1>"structure python:form.t1.render(t1)"</FONT><FONT color=#0000c0 size=1> size=</FONT><FONT color=#0000ff size=1>"10"</FONT><FONT color=#0000c0 size=1> value=</FONT><FONT color=#0000ff size=1>"0"</FONT><FONT color=#0000c0 size=1> /-- </FONT>onchange=</FONT><FONT size=1>"addition(t1.value,t2.value,t3)"--</FONT></P>
<P>--input type=<FONT color=#0000ff size=1>"text"</FONT><FONT color=#0000c0 size=1> name=</FONT><FONT color=#0000ff size=1>"t2"</FONT><FONT color=#0000c0 size=1> </FONT></P>
<P><FONT color=#0000c0 size=1>tal:content=</FONT><FONT color=#0000ff size=1>"structure python:form.t2.render(t2)"</FONT><FONT color=#0000c0 size=1> size=</FONT><FONT color=#0000ff size=1>"10"</FONT><FONT color=#0000c0 size=1> value=</FONT><FONT color=#0000ff size=1>"0"</FONT><FONT color=#0000c0 size=1> /-- </FONT>onchange=<FONT size=1>"addition(t1.value,t2,value,t3)"--</FONT></P>
<P>--input type=<FONT color=#0000ff size=1>"text"</FONT><FONT color=#0000c0 size=1> name=</FONT><FONT color=#0000ff size=1>"t3"</FONT><FONT color=#0000c0 size=1> </FONT></P>
<P><FONT color=#0000c0 size=1>tal:content=</FONT><FONT color=#0000ff size=1>"structure python:form.t3.render(t3)"</FONT><FONT color=#0000c0 size=1> size=</FONT><FONT color=#0000ff size=1>"10"</FONT><FONT color=#0000c0 size=1> </FONT><FONT size=1>--</FONT></P>
<P><FONT size=1>t1,t2 (textfields )are defined in the formulator .</FONT></P>
<P><FONT size=1>how do i make it work? I actually understand that after rnning a file that takes elements from the formulator, it names it as field_t1,field_t2,</FONT></P>
<P><FONT size=1>is there any solution or alternative</FONT></P>
<P><FONT size=1>my actual requirement is that , using the values entered in t1 &amp; t2 i shud add them &amp; put in the text box t3 also defined in the formulator .</FONT></P>
<P><FONT size=1>my javascript function states that </FONT></P><FONT color=#0000c0 size=1>
<P>&lt;script type</FONT><FONT size=1>="text/javascript"</FONT><FONT color=#0000c0 size=1>&gt;</P></FONT><FONT color=#800000 size=1>
<P>function addition(arg1,arg2,arg3) </P>
<P>{</P>
<P>var added = parseInt(arg1) + parseInt(arg2);</P>
<P>arg3.value = added;</P>
<P>}</P></FONT>
<P><FONT size=1>plz help me</FONT></P>
<P><FONT size=1>thanks</FONT></P>
<P><FONT size=1>exteam</P></FONT>
<P>&nbsp; <B><I>Jean Jordaan &amp;lt;jean@upfrontsystems.co.za&amp;gt;</I></B> wrote: 
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">Hi Exteam<BR><BR>In the footer of every mail from the zope lists, you may see this<BR>sentence:<BR><BR>** No cross posts or HTML encoding! **<BR><BR>So please: no cross posts or HTML encoding.<BR><BR>Regarding your question. You send code like:<BR><BR>"""<BR><TR tal:define="t1 request/t1|nothing;<br>                 t2 request/t2|nothing;<br>                 t3 request/t3|nothing"><BR><TD width="14%"><BR><INPUT name=t1 <br> onchange="addition(t1.value,t2.value,t3)"<BR>"""<BR><BR>It looks as though you want to use TAL-defined variables (t1, t2, t3)<BR>in your javascript. This is how to do that:<BR><BR>"""<BR><INPUT name=t1 <br> onchange="replaced by TAL"<BR>tal:attributes="onchange string:addition(${t1}.value,<BR>${t2}.value,<BR>${t3})"<BR>"""<BR><BR>-- <BR>Jean Jordaan<BR>http://www.upfrontsystems.co.za<BR><BR><BR>_______________________________________________<BR>Zope maillist -
 Zope@zope.org<BR>http://mail.zope.org/mailman/listinfo/zope<BR>** No cross posts or HTML encoding! **<BR>(Related lists - <BR>http://mail.zope.org/mailman/listinfo/zope-announce<BR>http://mail.zope.org/mailman/listinfo/zope-dev </BLOCKQUOTE><p><font face=arial size=-1><img src="http://in.yimg.com/i/in/mobile/pctomob.gif" width=28 height=22 border=0 alt="Yahoo! India Mobile"></a>
<a href="http://in.mobile.yahoo.com/new/pc/" target="_blank"><b>SMS</b></a> using the Yahoo! 
<a href="http://in.mobile.yahoo.com/new/pc/"><b>Messenger</a>;</b></font>
<font face=arial size=-1><b>
<a href="http://in.messenger.yahoo.com/">Download</b></a> latest version.</font>
--0-114533063-1057587432=:98088--