[Zope] How to Use Javascript returns in DTML tags

Laurie Nason laurien@blake.3dem.bioch.bcm.tmc.edu
Tue, 23 Oct 2001 14:45:20 -0500


You can't do what you are trying to do in this manner :-( .... however there
is hope! :-)

I assume that you have 2 frames, one with the rfqNumber and the other to
display the results - very similar to the ZMI. You have to have the frame
with the number call a page in the other frame. This page then takes that
number and uses it in from the REQUEST object and plugs it into your query.
So you could submit the first frame and target it to the other frame, or you
could set up a hyperlink with the query parameter stuck on the end of it.

hth
Laurie
PS only post to this list in Text - people get testy if you don't!
-----Original Message-----
From: Scheck, Herman [mailto:Herman.Scheck@intp.com]
Sent: Tuesday, October 23, 2001 2:28 PM
To: 'Laurie Nason'
Subject: RE: [Zope] How to Use Javascript returns in DTML tags


Hi Laurie,
I am trying to read the dynamic content of a frame with a Javascript
function and concatenate the return (rfqNumber) to an argument (an SQL
string) of an external Python method (dataAccess) which is called from
within a <dtml-in> tag.  In other words, I want to dynamically build (from
dynamic page content) the SQL statement which is an argument to a method
called by the <dtml-in> tag:
<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')">
Is this possible?  If not, is there an alternative?
Thanks for your response,
-Herman
-----Original Message-----
From: Laurie Nason [mailto:laurien@blake.3dem.bioch.bcm.tmc.edu]
Sent: Tuesday, October 23, 2001 11:54 AM
To: Scheck, Herman
Subject: RE: [Zope] How to Use Javascript returns in DTML tags


Hi Herman and welcome to Zope!
Could you give us a bit more background to what you are trying to achieve,
as I believe (from looking at your method below)
that you cannot do what you are trying to as DTML is interpreted when the
server formats the page - java script is a client side thing.
Laurie
-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
Scheck, Herman
Sent: Tuesday, October 23, 2001 1:45 PM
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['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-->
_______________________________________________
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 )