[Zope] Zope and Javascript

Ausum Studio ausum_studio at hotmail.com
Fri Apr 16 02:12:33 EDT 2004


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 at engin.umich.edu>
To: <zope at 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 at 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 )
>



More information about the Zope mailing list