Does anyone know of any resources that describe the use of Javascript within Zope? In particular, I am trying to call a Javascript function using the onChange event handler that is tied to a HTML select element. I need this Javascript function to perform an SQL query and then have it populate another HTML select element with the result set. Is this possible within Zope considering that queries are performed by Z SQL methods and possible other factors that I am unaware of? Any help would be greatly appreciated. Thanks. - Asad
Asad, Wednesday, April 14, 2004, 8:27:39 PM, you wrote:
Does anyone know of any resources that describe the use of Javascript within Zope? In particular, I am trying to call a Javascript function using the onChange event handler that is tied to a HTML select element. I need this Javascript function to perform an SQL query and then have it populate another HTML select element with the result set. Is this possible within Zope considering that queries are performed by Z SQL methods and possible other factors that I am unaware of? Any help would be greatly appreciated. Thanks.
As javascript is executed on the client, not on the server, where the sql is, you will need some way for Javascript to talk to Zope without refreshing the browser window. I have used the vcXMLRPC library ( http://www.vcdn.org/Public/XMLRPC/ ) with great success for this kind of thing. - It should work almost out of the box as Zope has great support for XMLRPC. Good luck -- __________________________________________________________________ Geir Bækholt · Interaction Engineer · Plone Solutions Development · Training · Support · http://www.plonesolutions.com __________________________________________________________________
On Thursday 15 April 2004 03:30 am, Geir Bækholt wrote:
As javascript is executed on the client, not on the server, where the sql is, you will need some way for Javascript to talk to Zope without refreshing the browser window. I have used the vcXMLRPC library ( http://www.vcdn.org/Public/XMLRPC/ ) with great success for this kind of thing. - It should work almost out of the box as Zope has great support for XMLRPC.
Ooooh. Nice tip. I'm not sure what I can do with this, but it sure makes me feel creative. ;-) Thanks, Terry -- Terry Hancock ( hancock at anansispaceworks.com ) Anansi Spaceworks http://www.anansispaceworks.com
Terry Hancock wrote:
On Thursday 15 April 2004 03:30 am, Geir Bækholt wrote:
As javascript is executed on the client, not on the server, where the sql is, you will need some way for Javascript to talk to Zope without refreshing the browser window. I have used the vcXMLRPC library ( http://www.vcdn.org/Public/XMLRPC/ ) with great success for this kind of thing. - It should work almost out of the box as Zope has great support for XMLRPC.
Ooooh. Nice tip. I'm not sure what I can do with this, but it sure makes me feel creative. ;-)
The main caveat to using vcXMLRPC is that some browsers still cannot use it. It uses the xmlHTTP function in javascript, which is only available in recent IE- and Mozilla-based browsers. This is notably not in any of the konquerors, like Safari, unless that has changed recently. If you have a captive audience (known or specifiable browsers) for a special app, it does work well. It is used in a project I have been working on for online quizzes. I have an example quiz online at http://caeep2.edtl.vt.edu/bozquiz/ -- Jim Washington
Actually the answer is up to javascript rather than Zope. You just need any method, i.e. "dynjavascript.js", that queries your sql database according to passed parameters, and that returns javascript code. Then you generate "dynparameters" within your page, in order to call a function inside dynjavascript.js. <html><head> <script type="text/javascript"><!-- function generatejs(params){ var s = document.createElement("script"); s.type = "text/javascript"; s.src = "dynjavascript.js?" + params; document.getElementsByTagName("head")[0].appendChild(s); return null;} //--></script> </head> <body> <script> //just a sample, you generate the one you need var dynparameters="key1=value1&key2=value2"</script> <a onclick="return generatejs(dynparameters);function_inside_dynjavascript();"> sample usage</a> </body> </html> Ausum ----- Original Message ----- From: "Asad Habib" <ahabib@engin.umich.edu> To: <zope@zope.org> Sent: Wednesday, April 14, 2004 1:27 PM Subject: [Zope] Zope and Javascript
Does anyone know of any resources that describe the use of Javascript within Zope? In particular, I am trying to call a Javascript function using the onChange event handler that is tied to a HTML select element. I need this Javascript function to perform an SQL query and then have it populate another HTML select element with the result set. Is this possible within Zope considering that queries are performed by Z SQL methods and possible other factors that I am unaware of? Any help would be greatly appreciated. Thanks.
- Asad
_______________________________________________ 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 )
participants (5)
-
Asad Habib -
Ausum Studio -
Geir Bækholt -
Jim Washington -
Terry Hancock