Simple way of doing this would be to concatenate the addresses together in
SQL, then use ValueList to populate the javascript:

<cfquery name="getAddresses">
SELECT Name + ', ' + address + ', ' + city + ', ' + state AS address
FROM yourTable
</cfquery>

<cfset addresslist = ValueList(getAddresses.address)>



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 08, 2007 2:56 PM
To: CF-Talk
Subject: populate a javascript var with cfoutput?

I need to dynamically populate "addresses" as shown below:

<script type="text/javascript">
var addresses = new Array("Redwood City, CA", "Palo Alto, CA", "Santa Clara,
CA", "San Jose, CA", "Sunnyvale, CA", "Mountain View, CA", "Milpitas,CA");
</script>

I've been trying to use listappend but keep running into the issue of the
quotes as delimiters above.

<cfset addresses ="">

 <cfoutput query="qry_getaddresses">
        
<cfset addresses = listappend(addresses, "#name#, #address#, #city#,
#state#")>
                
</cfoutput>     

Am I missing the boat entirely on this?



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion MX7 by AdobeĀ®
Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. 
Free Trial. http://www.adobe.com/products/coldfusion

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:272066
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to