Help. I am so lost and frustrated. I am using xml-rpc with server-side perl modules and subroutines. But, I do not know how to access these through javascript so I can spit out the results from my zope page template. I have been using a client-side python script to access these subrountines and creating external methods to use them in my zpt, but now I need to use one of these subroutines though an 'onclick'. And of course, I have learned the hard way that zope can not be accessed directly through javascript. I have also been told that Epoz uses javascript in this way but after looking at Epoz I am completely lost and do not know where to start. I am hoping that someone knows a simple or basic way of doing this for someone like me that is a new programmer. Thank You.
On Tue, 2004-10-05 at 17:30, Laura McCord wrote:
Help.
I am so lost and frustrated. I am using xml-rpc with server-side perl modules and subroutines. But, I do not know how to access these through javascript so I can spit out the results from my zope page template.
So... the first problem is getting the jargon right here... A Zope Page Template (or a Python Script or a DTML method, etc) is capable of *generating* JavaScript code in rendered output. However this is about as much integration as there is between Zope and Javascript. Javascript operates completely within the browser and Zope really knows nothing about it. You probably know this already but it's worth repeating. In the above sentence you say "I do not know how to access these through javascript". It's unclear what "these" are in that sentence. Are you trying to access an XML-RPC server via JavaScript? Is that XML-RPC server a Zope server? Or is it some other system? If it is a Zope server, is it the same Zope server that is generating your HTML? Or is it another Zope server? (Hint: it could be any XML-RPC server). It might be advantageous to serve up the JavaScript and HTML from a system other than Zope to get a better understanding of what's going on here. You should be able to set up a static piece of HTML (maybe served up by Apache) with JavaScript in it to access an XML-RPC server (Zope or otherwise). That will make clear one source of potential confusion temporarily while you get the solution worked out. Zope will provide very little on top of whatever you devise to facilitate XML-RPC communications between the browser (in JavaScript) and whatever server you're trying to talk to. Zope's only potential contribution here is to allow you to *generate* JavaScript and it doesn't appear that you need to do that; at least you haven't mentioned needing to do it yet.
I have been using a client-side python script to access these subrountines and creating external methods to use them in my zpt, but now I need to use one of these subroutines though an 'onclick'.
I'm afraid the jargon is so mixed up here that nobody can really know what you're trying to do. What is a "client-side python script'? Why are you using external methods (these are usually only used when you're attempting to do something that the Zope security machinery won't allow you to do in a Python Script, and you make no mention of security here at all)? I *think* you're at a place where you've discovered: - an "onlick" handler in JavaScript can't call a Zope method directly; instead it can only call JavaScript code. - you need an onlick handler to do something that effects the Zope server; this must be implemented in JavaScript. - a good way to do this is to use XML-RPC. Is that right?
And of course, I have learned the hard way that zope can not be accessed directly through javascript. I have also been told that Epoz uses javascript in this way but after looking at Epoz I am completely lost and do not know where to start.
I am hoping that someone knows a simple or basic way of doing this for someone like me that is a new programmer.
What you've explained that you're attempting to do is not particularly easy: there's nothing simple or basic about it unfortunately. Is there a way to do it that doesn't involve JavaScript? This would make things much easier. If not, I'd suggest trying to implement this in very, very small pieces. e.g. make a JavaScript function that does something simple like, calls an XML-RPC method that returns "1+1" and then displays the result 2 within the DOM using JavaScript, then build up from there incrementally. - C
participants (2)
-
Chris McDonough -
Laura McCord