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? Thanks in advance for any help. <SCRIPT LANGUAGE=JAVASCRIPT> <!-- function GetRFQNumber{ rfqNumber=parent.frames('fraQuoteRequest').document.all['QUOTEREQUEST'].inne rText; return rfqNumber; } --> </SCRIPT> <!--FORM ID="GetQuoteForm" ACTION="Quote_html"--> <H3> <dtml-with siteMethods> Quote: <dtml-let DNS=dbDNS UID=dbUID PWD=dbPWD> <SELECT NAME="selQuote" SIZE=1> <dtml-in expr="dataAccess(DNS, UID, PWD, 'SELECT quoteNumber FROM qt_quotes_t, qt_quoteReqs_t WHERE qt_quotes_t.quoteReqID = qt_quoteReqs_t.quoteReqID AND qt_quoteReqs_t.rfqNumber = ' + _.chr(39) + rfqNumber + _.chr(39) + ' ORDER BY quoteNumber')"> <dtml-in sequence-item> <OPTION VALUE='<dtml-var sequence-item>'><dtml-var sequence-item> </dtml-in> </dtml-in> </SELECT> </dtml-let> </dtml-with> <BR><BR><INPUT TYPE="IMAGE" SRC="images/imgRetrieveButton" ALT="Retrieve Quote Request"> </H3> <!--/FORM-->
[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? Cheers, Tom P
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 )
[Phil Harris] OK, Phil, it depends on what you are allowing at the browser end. It takes a very non-standard extension function in the browser to send xmlrpc, and if you used it, you could also send any other xml. But this still doesn't get the return into the dhtml as the poster asked for. You could also run a daemon on your own machine and have the page send a GET with your xml string to the daemon, which would then send it to Zope using xmlrpc, but I don't think that counts here, either. Cheers, Tom P
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, :)
Sounds to me like your trying to make a client side language pass info to a server-side language. Simply put, you can't do it. First thing is that the server-side does its thing and then sends that info to the client's browser. After that, its done! You have to generate a new request for the server to do anything else. Javascript runs client-side and after the server has completed its job. HTH, Tommy Innovation: The Best Way To Predict The Future ... Is To Create It.
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Scheck, Herman Sent: Tuesday, October 23, 2001 10:45 AM To: 'zope@zope.org' Subject: [Zope] How to Use Javascript returns in DTML tags
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?
Thanks in advance for any help.
<SCRIPT LANGUAGE=JAVASCRIPT> <!-- function GetRFQNumber{
rfqNumber=parent.frames('fraQuoteRequest').document.all['QUOTEREQU EST'].inne rText; return rfqNumber; } --> </SCRIPT>
<!--FORM ID="GetQuoteForm" ACTION="Quote_html"--> <H3> <dtml-with siteMethods> Quote: <dtml-let DNS=dbDNS UID=dbUID PWD=dbPWD> <SELECT NAME="selQuote" SIZE=1> <dtml-in expr="dataAccess(DNS, UID, PWD, 'SELECT quoteNumber FROM qt_quotes_t, qt_quoteReqs_t WHERE qt_quotes_t.quoteReqID = qt_quoteReqs_t.quoteReqID AND qt_quoteReqs_t.rfqNumber = ' + _.chr(39) + rfqNumber + _.chr(39) + ' ORDER BY quoteNumber')"> <dtml-in sequence-item> <OPTION VALUE='<dtml-var sequence-item>'><dtml-var sequence-item> </dtml-in> </dtml-in> </SELECT> </dtml-let> </dtml-with> <BR><BR><INPUT TYPE="IMAGE" SRC="images/imgRetrieveButton" ALT="Retrieve Quote Request"> </H3> <!--/FORM-->
_______________________________________________ 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 )
participants (4)
-
Phil Harris -
Scheck, Herman -
Thomas B. Passin -
Tommy Johnson