<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=US-ASCII">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2656.27">
<TITLE>Problem using LivePage/javascripts/event handlers</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2 FACE="Arial">I'm a relative noob to Twisted and Woven, but I'm trying to use them to serve some dynamic web content without success. There's two spots that I am most interested in:</FONT></P>
<P><FONT SIZE=2 FACE="Arial">When I include</FONT> <FONT FACE="Courier New"><span view="webConduitGlue" /></FONT> <FONT SIZE=2 FACE="Arial">in my xhtml file, the browser will spin its wheels forever. A big empty box is displayed at the bottom of the browser window and the browser status displays</FONT> <FONT FACE="Courier New">Transferring data from <myIP:port></FONT> <FONT SIZE=2 FACE="Arial">... . This behavior is consistent on Mozilla (I'm on Red Hat Linux OS) and on the latest Netscape (7.1). I checked to make sure javascript options were turned on in Netscape. Here is the Code:</FONT></P>
<P><B><FONT SIZE=2 FACE="Arial">Xhtml file:</FONT></B>
</P>
<P><FONT SIZE=2 FACE="Arial"><html></FONT>
<BR><FONT SIZE=2 FACE="Arial"> <head></FONT>
<BR><FONT SIZE=2 FACE="Arial"> <title>generic</title></FONT>
<BR><FONT SIZE=2 FACE="Arial"> </head></FONT>
<BR><FONT SIZE=2 FACE="Arial"> <body></FONT>
<BR><FONT SIZE=2 FACE="Arial"> <table model="listdata" view="listdatatable"></table></FONT>
<BR><FONT SIZE=2 FACE="Arial"> <span view="webConduitGlue" /></FONT>
<BR><FONT SIZE=2 FACE="Arial"> </body></FONT>
<BR><FONT SIZE=2 FACE="Arial"></html></FONT>
</P>
<P><B><FONT SIZE=2 FACE="Arial">Key Python/Twisted code:</FONT></B>
</P>
<P><FONT SIZE=2 FACE="Arial">class Epage(page.LivePage):</FONT>
<BR><FONT SIZE=2 FACE="Arial"> ...</FONT>
<BR><FONT SIZE=2 FACE="Arial"> def initialize(...):</FONT>
<BR><FONT SIZE=2 FACE="Arial"> self.someListData = [['a', 'b', 'c'],</FONT>
<BR><FONT SIZE=2 FACE="Arial"> ['d', 'e', 'f'],</FONT>
<BR><FONT SIZE=2 FACE="Arial"> ['g', 'h', 'I']]</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"> def wmfactory_listdata(self, request):</FONT>
<BR><FONT SIZE=2 FACE="Arial"> return self.someListData</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"> def wvupdate_listdatatable(self, request, node, listdata):</FONT>
<BR><FONT SIZE=2 FACE="Arial"> l = lmx(node)</FONT>
<BR><FONT SIZE=2 FACE="Arial"> d = l.div()</FONT>
<BR><FONT SIZE=2 FACE="Arial"> t = d.table(border='0', cellspacing='2')</FONT>
<BR><FONT SIZE=2 FACE="Arial"> t.tr(bgcolor='eeeeee')</FONT>
<BR><FONT SIZE=2 FACE="Arial"> for arow in listdata:</FONT>
<BR><FONT SIZE=2 FACE="Arial"> t.tr()</FONT>
<BR><FONT SIZE=2 FACE="Arial"> for entry in arow:</FONT>
<BR><FONT SIZE=2 FACE="Arial"> t.td().text(entry)</FONT>
<BR><FONT SIZE=2 FACE="Arial"> t.td().form().input(type='button', value='REMOVE', view='rmExercise')</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"> def wvupdate_rmExercise(controller.Controller):</FONT>
<BR><FONT SIZE=2 FACE="Arial"> def initialize(self):</FONT>
<BR><FONT SIZE=2 FACE="Arial"> self.view.addEventHandler("onclick", self.onClick)</FONT>
<BR><FONT SIZE=2 FACE="Arial"> self.view.addEventHandler("onmouseover", self.onMouseOver)</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"> def onClick(self, request, widget):</FONT>
<BR><FONT SIZE=2 FACE="Arial"> print self, "CLICKED!"</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"> def onMouseOver(self, request, widget, argument):</FONT>
<BR><FONT SIZE=2 FACE="Arial"> print self, "MOUSE OVER!", argument</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">The browser will draw me a table with buttons, but these events don't seem to get processed. So that brings me to the second trouble spot I am interested in. For those who know, am I embedding buttons in my table in an acceptable manner? Am I trying to handle events correctly? If the xhtml webConduitGlue was working would my event handling work? Please feel free to criticize any part of this code. Thanks,</FONT></P>
<P><FONT SIZE=2 FACE="Arial">Matthew</FONT>
</P>
</BODY>
</HTML>