[Zope] How to Use Javascript returns in DTML tags

Phil Harris phil.harris@zope.co.uk
Tue, 23 Oct 2001 23:48:27 -0400


On Tue, 23 Oct 2001 15:15:29 -0400
"Thomas B. Passin" <tpassin@mitretek.org> wrote:

> [Scheck, Herman]
> 
> > I am trying to simply use the return (rfqNumber) from a Javascript script
> as
> > a variable in a DTML tag (see code below).  I've also tried placing the
> > Javascript code in-line to the DTML, as well as trying to encapsulating
> the
> > script in a DTML method.  None of this seems to work.  Yes, I am fairly
> new
> > to DTML (and Zope, for that matter).  I have seen articles on how to pass
> > arguments from DTML to Javascript functions, but not on how to use
> > Javascript returns in DTML.  Can anyone point, push, or drag me in the
> right
> > direction?
> >
> 
> It sounds like you think that the browser client can talk to Zope.  No, it
> cannot.  The Zope DTML is constructed before the javascript is executed in
> the browser, and there is no way for Zope to know about such execution.
> 
> The only way you can send information from the browser to Zope is by
> submitting a form and having Zope act on the contents of the form.  You
> could use javascript to compute values and store them in fields in a form,
> but you have to submit it before Zope can learn about it.
> 
> Clear?

As crystal, *BUT*, what you say is not strictly true :)

For instance take a look at vcXMLRPC, http://www.vcdn.org/Public/XMLRPC, it's (obviously) an XMLRPC implementation for JavaScript, :).  I use it for instance when people are editing pages in a wysiwyg editor through the browser, the save button and, get this, the spell check button are done through xmlrpc calls back to Zope, the results returned can be anything, even javascript, which can be eval'ed and therefore affect the currect page, :)


> 
> Cheers,
> 
> Tom P
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )