[Twisted-web] Error: nevow_clientToServerEvent is not defined (Firefox JS Console)

Donovan Preston dp at ulaluma.com
Wed Jun 29 11:21:25 MDT 2005

On Jun 29, 2005, at 2:32 AM, Michael M wrote:

> Firstly, I love nevow, brilliant design, really just plain brilliant.
> Thanks in advance for any help with this problem.
> The livepage/evil example failes with this error in the Firefox JS  
> console
> Error: nevow_clientToServerEvent is not defined

Sorry, that example is way out of date. livepage is still under heavy  
development and has changed a lot in the last year or so. It has even  
changed a lot since the last release (0.4.1). If you would like to  
use livepage, I suggest you get a svn checkout of:


I have attached a simple example which works with this branch.

I hope to have livepage stabilized by the 0.5 release (bugfixes  
notwithstanding). There is still quite a bit of work to be done  
before this will actually happen though.

The reason nevow_clientToServerEvent was not defined in your tests is  
because the javascript which defines it was never included in the  
page. In the below example, you'll notice two render directives, one  
invoking "liveid" and one invoking "liveglue". The liveid is a  
fragment of javascript which embeds a unique id in every rendering of  
a LivePage. It changes every time the page is rendered. The liveglue  
is a fragment of javascript which never changes. It is separate from  
the liveid to allow you to have one global location for the liveglue  
javascript which every page references, to take advantage of browser  

The other difference with this example is the ease of calling a  
server-side function from javascript. Once the liveglue javascript  
has been included in a page, there is a global "server" object which  
has a "handle" method. The javascript in the example below was  
written by hand, not generated automatically by the nevow page  
rendering process. This makes it easier to hook up client-side event  
handlers to server side methods.

One final difference in the example below is that now server-side  
event handlers can return javascript which will be evaluated in the  
browser. Previously, you had to make calls on the ClientHandle object  
to send scripts to the browser (which you can still do if you need  
to). The new architecture instead renders the result of a server-side  
handler in a JavascriptContext. This means all the rendering  
advantages Nevow provides for HTML are also possible with JavaScript  
now (rendering generators, rendering multiple deferreds, much safer  
quoting, etc.)

Hope all this helps.

-------------- next part --------------
Skipped content of type multipart/mixed

More information about the Twisted-web mailing list