Toggling the overview panel on a CFMAP tag in ColdFusion




Toggling the overview panel on a CFMAP tag in ColdFusion The following example shows how you can toggle the overview panel on a CFMAP tag in ColdFusion by setting the Boolean overview attribute.   <html>   <cfajaximport params=”#{googlemapkey=’YourGoogleMapsAPIKeyHere’}#” /> <cfparam name=”URL.overview” default=”false” type=”boolean” />   <head> </head> <body style=”padding:20px;”>   <cfform method=”GET” action=”#CGI.SCRIPT_NAME#”> <cfinput name=”overview” type=”checkbox” value=”1″ checked=”#URL.overview#” onchange=”this.form.submit();” /> […]

Read more

Listening for map errors on the CFMAP tag in ColdFusion




Listening for map errors on the CFMAP tag in ColdFusion The following example shows how you can listen for map errors on the <CFMAP> tag in ColdFusion and JavaScript using the onError attribute.   <html>   <cfajaximport params=”#{googlemapkey=’YourGoogleMapsAPIKeyHere’}#” />   <head> <script type=”text/javascript”> function cfmap_onError(mapStatusCode, errorMessage) { alert(“Uh oh, I wasn’t able to find the specified address.ncode: ” + mapStatusCode); […]

Read more

Converting a database query to a WDDX packet using ColdFusion




Converting a database query to a WDDX packet using ColdFusion The following example shows how you can convert a database query to a XML WDDX packet using ColdFusion and the <CFWDDX> tag.   <cfquery name=”getArtists” datasource=”cfartgallery” maxRows=”5″> SELECT A.ARTISTID, A.FIRSTNAME, A.LASTNAME, A.ADDRESS, A.CITY, A.STATE FROM ARTISTS A </cfquery>   <cfwddx action=”cfml2wddx” input=”#getArtists#” output=”artistsWDDX” />   <cfoutput>#xmlFormat(artistsWDDX)#</cfoutput> And the output of […]

Read more

Toggling which columns are displayed from a database query using the CFDUMP tag in ColdFusion




Toggling which columns are displayed from a database query using the CFDUMP tag in ColdFusion The following example show how you can toggle which database query columns are displayed by the <CFDUMP> tag in ColdFusion by specifying the show or hide attribute.   <cfquery name=”getArtists” datasource=”cfartgallery” maxRows=”5″> SELECT A.ARTISTID, A.FIRSTNAME, A.LASTNAME, A.ADDRESS, A.CITY, A.STATE FROM ARTISTS A </cfquery>   <cfoutput> […]

Read more

Dynamically adding columns to a database query using ColdFusion




Dynamically adding columns to a database query using ColdFusion The following example shows how you can dynamically add a column to a database query in ColdFusion using the queryAddColumn() function.   <cfquery name=”getArtists” datasource=”cfartgallery” maxRows=”5″> SELECT A.ARTISTID, A.FIRSTNAME, A.LASTNAME FROM ARTISTS A </cfquery>   <cfset queryAddColumn(getArtists, “fullName”, ArrayNew(1)) /> <cfloop query=”getArtists”> <cfset querySetCell(getArtists, “fullName”, uCase(getArtists.LASTNAME & “, ” & getArtists.FIRSTNAME), […]

Read more

Adding the values in a database query column in ColdFusion




Adding the values in a database query column in ColdFusion The following example shows how you can get the average value and sum for a database query column in ColdFusion using the valueList(), listToArray(), arraySum(), and arrayAvg() functions.   <cfquery name=”getArtPrices” datasource=”cfartgallery” maxRows=”5″> SELECT A.PRICE FROM ART A </cfquery>   <cfset priceList = valueList(getArtPrices.price) /> <cfset priceArr = listToArray(priceList) /> […]

Read more

Getting started with Arrays in ColdFusion




Getting started with Arrays in ColdFusion The following examples show how you can get started with using the various Array functions in ColdFusion.   Creating a new Array in ColdFusion Modifying items in an Array in ColdFusion Determining the number of items in an Array in ColdFusion Swapping items in an Array in ColdFusion Determining whether an Array element is […]

Read more

Converting numbers between base 10 and base 16 using ColdFusion




Converting numbers between base 10 and base 16 using ColdFusion The following example shows how you can convert numbers and strings between base 10 (decimal) and base 16 (hexadecimal) in ColdFusion using the formatBaseN() and inputBaseN() functions.   <cfoutput> <table border=”1″> <tr> <td>formatBaseN(255, 16):</td> <td>#formatBaseN(255, 16)#</td> <!– ff –> </tr> <tr> <td>formatBaseN(6724044, 16):</td> <td>#formatBaseN(6724044, 16)#</td> <!– 6699cc –> </tr> <tr> […]

Read more

Getting started with Lists in ColdFusion




Getting started with Lists in ColdFusion The following examples show how you can get started with using the various List functions in ColdFusion.   Creating a new List in ColdFusion Determining the number of items in a List in ColdFusion Getting a specific item from a List in ColdFusion Appending and prepending items to a List in ColdFusion Inserting items […]

Read more

Displaying a database query in a grid using the CFGRID tag in ColdFusion




Displaying a database query in a grid using the CFGRID tag in ColdFusion The following examples show how you can display a database query in a grid using the <CFGRID> and <CFFORM> tags in ColdFusion.   <html>   <cfquery name=”getArtists” datasource=”cfartgallery”> SELECT A.* FROM ARTISTS A ORDER BY A.LASTNAME, A.FIRSTNAME </cfquery>   <head> </head> <body style=”padding:20px;”>   <cfform> <cfgrid name=”myGrid” […]

Read more
1 2