[Zope] does zope support java script

Jonathan dev101 at magma.ca
Wed Jul 18 08:00:38 EDT 2007


----- Original Message ----- 
From: "Mohammed Tlais" <m.tlais at gmail.com>
To: "Tim Nash" <thedagdae at gmail.com>
Cc: <zope at zope.org>
Sent: Wednesday, July 18, 2007 1:32 AM
Subject: Re: [Zope] does zope support java script


> Thank you Tim, thank you Andreas, thanks for all. You gave me valuable
> information.
>
> I figured out that the small browser inside ZMI has a problem with
> javascripts, it can't display them. But, when I visit the URL of the page
> from IE, the javascripts are executed normally. Am I right that ZMI can't
> displays JS ? and is there a solution for it.

I use two different methods for incorporating js into my routines:

1- For js code which is used by several routines:

I create a dtml method with a name like 'popup.js' and then put the js code 
into the dtml method (nothing in this method except js code).  I then 
include the js code into the target routine (another dtml method) using 
something like:

<html>
<head>
<script src="popup.js" language="JavaScript" 
type="text/javascript"></script>
...
The js popup routine can then be called from anywhere within this dtml 
method


2- For js code that is used by only one rotuine, I include it directly in 
the target routine (a dtml method) as follows:

<dtml-var HeaderFrame2>
<script type="text/javascript">
    alert('Password Changed');
    location.href = '<dtml-var nextRoutine>';
</script>
<dtml-var FooterFrame2>


In both of the above cases, the js code is 'readable/editable' via the ZMI 
(just the same as the dtml code is). Note: the js code can be edited via the 
ZMI, but will not be executed unless you click on the 'View' tab of the dtml 
method that contains the js code.

Zope works very well with js and can add significant flexibility and 
functionality to your applications.

hth

Jonathan 



More information about the Zope mailing list