i've seen this question before.  I'm wondering why it's such a big de
al to
convert a query into a javascript array...

Is it not the case that all you have to do is write the js array to the

page in your <cfoutput> right when you DOING the query?

thanks for the help!





"Steve Oliver" <[EMAIL PROTECTED]> on 01/21/2002 04:16:38 PM

Please respond to [EMAIL PROTECTED]

To:   CF-Talk <[EMAIL PROTECTED]>
cc:

Subject:  RE: javascript/coldfusion--- Can you do this?


Look into WDDX, CFML2JS will create an array of all of your values for
you.

Something like
<script>
<cfwddx action="cfml2js" input="qryName"
toplevelvariable="variablename">
</script>

That will result in
<script>
variablename = new array stuff
</script>

You'll need to include wddx.js which is in your cfide/scripts folder.


______________________
steve oliver
cresco technologies, inc.
http://www.crescotech.com


-----Original Message-----
From: Metzy Martinez [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 21, 2002 4:55 PM
To: CF-Talk
Subject: javascript/coldfusion--- Can you do this?


i have an application that saves a listing entry. this entry can have

multiple number of addresses. so i have a child window that pops up.

this window then calls addresspost.cfm, this is the code you will fin
d
below, and with this page i save the address and proceed to get all of
the address that belong to the specific listing_id. once i get all of

the addresses i place them into an array. but now i'm trying to pass
that array into javascript and don't know how.

Please help SomeOne
Thank you
Metzy



<cfparam name="txtListing_Id" default="">
<cfparam name="selArea" default="">
<cfparam name="txtStreet1" default="">
<cfparam name="txtStreet2" default="">
<cfparam name="txtCity" default="">
<cfparam name="selState" default="">
<cfparam name="txtZip" default="">
<cfparam name="txtPhone" default="">
<cfparam name="txtFax" default="">
<cfparam name="txtEmail" default="">
<cfparam name="txtHours" default="">
<cfparam name="txtDescription" default="">
<cfparam name="txtKeywords" default="">
<cfparam name="chkActive" default="off">
<cfoutput>
<cfquery name="address" datasource="#dsn.listings_v2#">
INSERT INTO
address
(Listing_Id, area_Id, street1, street2, city, state,
zipCode, phone, fax, email, hours, description, keywords, active)
VALUES
(#txtListing_Id#, '#selArea#', '#txtStreet1#',
'#txtStreet2#', '#txtCity#', '#selState#', '#txtZip#', '#txtPhone#',
'#txtFax#', '#txtEmail#', '#txtHours#', '#txtDescription#',
'#txtKeywords#',
'#chkActive#')
</cfquery>
<cfquery name="addressArray" datasource="#dsn.listings_v2#"
dbtype="ODBC"> SELECT
address_ID, street1
FROM
address
WHERE
listing_id = #txtListing_id#
</cfquery>
</cfoutput>
<cfif addressArray.recordCount GT 0>
<cfset arrValue = ArrayNew(1)>
<cfset arrLabel = ArrayNew(1)>
<cfloop index=i from=1 to=#addressArray.recordcount#>
<cfset arrValue = AddressArray.address_id>
<cfset arrLabel = 'addressArra.street'>
</cfloop>

<HTML>
<HEAD>
<META NAME="ROBOTS" CONTENT="NONE">
<SCRIPT LANGUAGE="JavaScript">
<!--
function refreshProduct()
{
// Rebuilds the catalog list for the product page.
// It is built here so that it can be returned to the product page and
reloaded window.opener.modifyAddress(#arrLabel#, #arrValue#);

window.close();
}
//-->

</SCRIPT>

</HEAD>
<BODY onload="javascript: refreshProduct();">
</body>
</HTML>
<cfelse>
<HTML>
<HEAD>
<META NAME="ROBOTS" CONTENT="NONE">
<SCRIPT LANGUAGE="JavaScript">
<!--
function refreshProduct()
{
// Rebuilds the catalog list for the product page.
// It is built here so that it can be returned to the product page and
reloaded

var arrValue;
var arrLabel;
window.opener.modifyaddress(arrLabel, 0);

window.close();

}
//-->

</SCRIPT>

</HEAD>
<BODY onload="javascript: refreshProduct();">
</body>
</HTML>

</cfif>

-------------------------
Metzy Matinez



______________________________________________________________________
Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation · $99/Month · Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to