other successful variant
Instead
var node = $("termid");
to use
var node = document.getElementById("termid");
that about was written by Jean-Paul
2007/12/9, Михаил Михайлов <[EMAIL PROTECTED]>:
>
> i had refused using nodeid ("termid") and It has been worked in later
> nevow version (0.9.27)!
>
> I tried to get widget in 2 ways
> 1)
> var node = $("termid");
> var widget = Nevow.Athena.Widget.get (node);
> 2)
> var widget = Nevow.Athena.Widget.fromAthenaID("termid");
>
> both of a case give exception (cannot find node by id)
>
> I've added a method keypress2 into AaccWeb.Users (aacc_web.js)
> and string mystr = u"""<textarea cols="10" rows="5" onkeypress="return
> Nevow.Athena.Widget.get(this).keypress2(event);">""" + sym +
> u"""</textarea>""" into aacc_web.py
>
>
> aacc_web.py
>
> < mystr = u"""<textarea id="termid" cols="10" rows="5" onkeypress="return
> keypress(event)">""" + sym + u"""</textarea>"""
> > #mystr = u"""<textarea id="termid" cols="10" rows="5" onkeypress="return
> keypress(event)">""" + sym + u"""</textarea>"""
> > mystr = u"""<textarea cols="10" rows="5" onkeypress="return
> Nevow.Athena.Widget.get(this).keypress2(event);">""" + sym +
> u"""</textarea>"""
>
>
> aacc_web.js
>
> // import Nevow.Athena
>
> function keypress(event)
> {
> var key = event.charCode ? event.charCode : event.keyCode;
> //var node = $("termid");
> //var widget = Nevow.Athena.Widget.get(node);
> var widget = Nevow.Athena.Widget.fromAthenaID("termid");
> if (widget) {
> alert("widget get ok");
> widget.callRemote("aacc_keypress", event.charCode, event.keyCode,
> event.metaKey, event.altKey, event.ctrlKey, event.shiftKey);
> }
> else {
> alert("widget get error");
> }
> }
>
> AaccWeb.Users = Nevow.Athena.Widget.subclass ("AaccWeb.Users");
> AaccWeb.Users.methods(
>
> > function keypress2(self, event)
> > {
> > var key = event.charCode ? event.charCode : event.keyCode;
> > self.callRemote("aacc_keypress", event.charCode, event.keyCode,
> event.metaKey, event.altKey, event.ctrlKey, event.shiftKey);
> > },
>
> function start(self, node, event) {
> self.callRemote("aacc_start");
> return false;
> },
>
> function showConference(self, toWhat) {
> var client_data = Nevow.Athena.NodeByAttribute(self.node, "class",
> "Users");
> client_data.innerHTML = toWhat;
> }
> );
>
> ps:
> however, why in old versions (0.9.0) it worked without these changes and
> in new (0.9.27) is not
>
>
>
> 2007/12/9, Михаил Михайлов < [EMAIL PROTECTED]>:
> >
> > Jean-Paul
> > thanks for the operative answer
> > but my file aacc_web.py contains a line u " AaccWeb.Users" instead of u
> > " AaccWeb.Users"
> > the space is not present,
> > space have appeared because of copying the text from my electronic
> > translator
> > (differently it did not work and in version 9.0 but it works)
> > If You will give Your mail I can send files
> > problem probably another
> >
> >
> > 2007/12/9, Jean-Paul Calderone < [EMAIL PROTECTED]>:
> > >
> > > On Sun, 9 Dec 2007 00:43:31 +0300, Михаил Михайлов <
> > > [EMAIL PROTECTED]> wrote:
> > > >Hi
> > > >
> > > >my example consists 2 files: aacc_web.py and aacc_web.js
> > > >
> > > >python aacc_web.py
> > > >will start on port 8080
> > > >
> > > >generated html contains textarea and in case of input
> > > >prints the entered symbol on the console and in textarea
> > > >It works ONLY in version 9.0 and does NOT (!) work in last versions
> > > >
> > > >Explain what's wrong
> > > >
> > >
> > > You're using a feature of MochiKit, $(). Athena pages used to include
> > >
> > > MochiKit by default, but they don't anymore. This may be the problem.
> > >
> > > Your JavaScript file includes "//import Nevow.Athena" which will be
> > > ignored. This should be "// import Nevow.Athena ". This probably
> > > isn't
> > > the cause of the problem, but it's still wrong.
> > >
> > > Your Python class "Users" has a jsClass of u" AaccWeb.Users". This
> > > causes
> > > a KeyError because there is no such class. Instead it should be
> > > u"AaccWeb.Users".
> > >
> > > After changing these three things, I see events being reported on the
> > > server.
> > >
> > > Jean-Paul
> > >
> > > _______________________________________________
> > > Twisted-web mailing list
> > > [email protected]
> > > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
> > >
> >
> >
>
>
_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web