[Zope] How do you replace content with an action?

robert rottermann robert at redcor.ch
Sat Sep 4 09:27:48 EDT 2004


Jonathan,
tough your solution is a clever way to easen the burden of a partial 
page update, it does not not alter the fact, that javascript can not 
talk to the server. It only can submit a call to the server, asking it 
to send a new page. Whether this new page replaces the actual or a new 
frame (or the content of an iframe) is an other question.

It is a common error, and I have the impression Laura has fallen prey to 
it, not to clearly separate the server and client "place of action".

Robert

Jonathan Hobbs wrote:
> From: "robert rottermann" <robert at redcor.ch>
> To: "Laura McCord" <Laura.McCord at doucet-austin.com>
> 
>>Laura,
>>
>>as somebody else told you in an other thread, you must be careful to
>>distinguish between what happens on the server and and what on the client.
>>Zope and it's tools work solely on the the server, java script only on
>>the server.
>>Tal templates work on the server to prepare a html page that zoope will
>>send to your client. Once it is there your java script can deal with it.
>>
>>This two phases are run in total isolation and neither of the two is
>>avare of the other. Furthermore, there is no easy way for the two, to
>>communicate.
> 
> 
> I haven't been paying too much attention to this thread, but the comment
> 'there is no easy way for the two to communicate' caught my attention.
> 
> You can set up, quite easily, a way for your client-side javascript to
> communicate with the server-side zope which is invisible (well, to the
> non-technical) to the end-user.
> 
> Start by creating a hidden iframe in your html page (call this 'Page 1').
> Set the initial url to be loaded to point to a method on the zope server.
> The method on the zope server does some action (ie. a db lookup) and assigns
> the results to javascript variables; the key piece is to have some html in
> the method which has a javascript 'onload' command which invokes a
> javascript function (which is defined in the code for 'Page 1'); this js
> function does something with the js variables that were created by the zope
> method and modifies the display on 'Page 1'.
> 
> Very kewl way to load a single page and then keep it updated with info from
> the server (ie. you can use js to keep loading zope methods into the iframe
> and then handle the returned data)!
> 
> HTH
> 
> Jonathan
> 
> 
> 
> 
> 
> 


More information about the Zope mailing list