Javascript variables Form element values and zope
Hallo All, I have this little form and I would like to know how to persuade dtml or python to access the javascript variables in the set_p function and the element values in the form "LOG". I'll be thankful for any assistance. <html><head> <script language="JAVASCRIPT"> function set_p(a,b) { // // call a zsql script mylookup which returns a single value // document.p.value=<dtml-call expr="mylookup(a,b)"> // //alternatively //document.p.value=<dtml-call expr="mylookup(document.LOG.m.value,document.LOG.n.value)"> // } </script> </head><body> <form name="LOG"> <table> <tr> <td><input type=text name="m" value=""></td> <td><input type=text name="n" value=""></td> <td><input type=text name="p" value=""></td> <td><input type=button value="Update P" onclick=set_p(m.value,c.value)></td></tr></table> </form></body></html> Gavin
GBPark@ed.ac.uk wrote at 2003-10-3 13:34 +0100:
I have this little form and I would like to know how to persuade dtml or python to access the javascript variables in the set_p function and the element values in the form "LOG".
I cannot do that: DTML lives on the server, Javascript on the client. The server cannot reach out to the client. Dieter
This list is for development of Zope. You want the zope users list at zope@zope.org.
I have this little form and I would like to know how to persuade dtml or python to access the javascript variables in the set_p function and the element values in the form "LOG".
This is impossible as you put it. You realize that Javascript is totally client side, and that to Zope it is nothing more than extra bytes to shove out to your browser, right? Javascript can only manipulate the DOM within a browser, and Zope can only manipulate the contents of the page before it is sent to the browser.
I'll be thankful for any assistance.
<html><head> <script language="JAVASCRIPT"> function set_p(a,b) { // // call a zsql script mylookup which returns a single value // document.p.value=<dtml-call expr="mylookup(a,b)"> // //alternatively //document.p.value=<dtml-call expr="mylookup(document.LOG.m.value,document.LOG.n.value)"> // } </script> </head><body> <form name="LOG"> <table> <tr> <td><input type=text name="m" value=""></td> <td><input type=text name="n" value=""></td> <td><input type=text name="p" value=""></td> <td><input type=button value="Update P" onclick=set_p(m.value,c.value)></td></tr></table> </form></body></html>
However, Zope can see the values of request parameters (from the form) once the form is submitted. If you, say, give the form an action of 'someZopeObject' then the form will be submitted to that object and you will be able to access the values of m, n, and p as they were just before the form was sent. --jcc -- "My point and period will be throughly wrought, Or well or ill, as this day's battle's fought."
participants (3)
-
Dieter Maurer -
GBPark@ed.ac.uk -
J. Cameron Cooper