You are on page 1of 368

ColdFusion Example

By Saiful Alam

Ebook Version 0.2


Last updated 15-March-2011
Please visit coldfusion-example.blogspot.com for latest ebook version
Example 1

ArrayNew function example: how to create an array

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ArrayNew function example: how to create an array</title>
</head>

<body>
<h2 style="color:Green">ArrayNew Function Example</h2>

<cfset ColorArray = ArrayNew(1)>


<cfset Temp=ArrayAppend(ColorArray,"Red")>
<cfset Temp=ArrayAppend(ColorArray,"Green")>
<cfset Temp=ArrayAppend(ColorArray,"Blue")>
<cfdump var="#ColorArray#">
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/arraynew-function-example-how-to-create.html
Example 2

ArrayNew function example: how to create a two dimension


array
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ArrayNew function example: how to create a two dimension
array</title>
</head>

<body>
<h2 style="color:Crimson">ArrayNew function Example: Two Dimensions</h2>

<cfset ColorArray=Arraynew(2)>

<cfset ColorArray[1][1]="Aquamarine">
<cfset ColorArray[1][2]="##7FFFD4">

<cfset ColorArray[2][1]="Azure">
<cfset ColorArray[2][2]="##F0FFFF">

<cfset ColorArray[3][1]="Beige">
<cfset ColorArray[3][2]="##F5F5DC">

<cfset ColorArray[3][1]="Bisque">
<cfset ColorArray[3][2]="##FFE4C4">

<cfdump var="#ColorArray#" label="ColorArray[Two Dimensions]">

</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/arraynew-function-example-how-to-
create_2871.html
Example 3

ArrayNew function example: how to create a three dimension


array
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ArrayNew function example: how to create a three dimension
array</title>
</head>

<body>
<h2 style="color:Crimson">ArrayNew function Example: Three
Dimensions</h2>

<cfset ColorArray=Arraynew(3)>

<cfset ColorArray[1][1][1]="1">
<cfset ColorArray[1][1][2]="Red">
<cfset ColorArray[1][1][3]="##FF0000">

<cfset ColorArray[1][2][1]="2">
<cfset ColorArray[1][2][2]="IndianRed">
<cfset ColorArray[1][2][3]="##CD5C5C">

<cfset ColorArray[2][1][1]="1">
<cfset ColorArray[2][1][2]="Green">
<cfset ColorArray[2][1][3]="##008000">

<cfset ColorArray[2][2][1]="2">
<cfset ColorArray[2][2][2]="GreenYellow">
<cfset ColorArray[2][2][3]="##ADFF2F">

<cfdump var="#ColorArray#" label="ColorArray[Three Dimensions]">

</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/arraynew-function-example-how-to-
create_22.html
Example 4

ArraySwap function example: how to swap array values of an


array at specified positions
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ArraySwap function example: how to swap array values of an array
at specified positions</title>
</head>

<body>
<h2 style="color:Green">ArraySwap Function Example</h2>

<cfset ColorArray = ArrayNew(1)>


<cfset ArrayAppend(ColorArray,"Red")>
<cfset ArrayAppend(ColorArray,"Green")>
<cfset ArrayAppend(ColorArray,"Blue")>
<cfdump var="#ColorArray#" label="ColorArray">

<br />
<cfset Temp = ArraySwap(ColorArray,1,3)>
<cfdump var="#ColorArray#" label="ColorArray[After Swap Position 1,3]">
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/arrayswap-function-example-how-to-swap.html
Example 5

ArraySort function example: how to sort array elements

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ArraySort function example: how to sort array elements</title>
</head>

<body>
<h2 style="color:Green">ArraySort Function Example</h2>

<cfset ColorArray = ArrayNew(1)>


<cfset Temp=ArrayAppend(ColorArray,"Red")>
<cfset Temp=ArrayAppend(ColorArray,"Blue")>
<cfset Temp=ArrayAppend(ColorArray,"Green")>
<cfdump var="#ColorArray#" label="ColorArray">

<br />
<cfset Temp=ArraySort(ColorArray,"text","asc")>
<cfdump var="#ColorArray#" label="ColorArray[Sorted ascending]">

<br />
<cfset Temp=ArraySort(ColorArray,"text","desc")>
<cfdump var="#ColorArray#" label="ColorArray[Sorted descending]">

</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/arraysort-function-example-how-to-sort.html
Example 6

ArrayResize function example: how to reset an array to a


specified minimum number of elements
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ArrayResize function example: how to reset an array to a specified
minimum number of elements</title>
</head>

<body>
<h2 style="color:Green">ArrayResize Function Example</h2>

<cfset ColorArray = ArrayNew(1)>


<cfset Temp = ArrayAppend(ColorArray,"DarkGreen")>
<cfset Temp = ArrayAppend(ColorArray,"DarkKhaki")>
<cfoutput><b>ColorArray Size: #Arraylen(ColorArray)#</b></cfoutput>
<cfdump var="#ColorArray#" label="ColorArray">

<br />
<cfset Temp = ArrayResize(ColorArray,5)>
<cfoutput><b>ColorArray Size[After Resize]:
#ArrayLen(ColorArray)#</b></cfoutput>
<cfdump var="#ColorArray#" label="ColorArray[After Resize]">
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/arrayresize-function-example-how-to.html
Example 7

ArrayIsDefined function example: how to determine whether an


array element is defined (exists)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ArrayIsDefined function example: how to determine whether an array
element is defined (exists)</title>
</head>

<body>
<h2 style="color:Green">ArrayIsDefined Function Example</h2>

<cfset ColorArray = ArrayNew(1)>


<cfset ColorArray[1] = "Coral">
<cfset ColorArray[3] = "CornflowerBlue">
<cfset ColorArray[4] = "Cornsilk">
<cfdump var="#ColorArray#" label="Color Array">

<br />
<cfoutput>
<b>
Element 2 exists?: #ArrayIsDefined(ColorArray,2)#
<br />
Element 3 exists?: #ArrayIsDefined(ColorArray,3)#
</b>
</cfoutput>
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/arrayisdefined-function-example-how-to.html
Example 8

ArrayInsertAt function example: how to insert array element at


specific position
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ArrayInsertAt function example: how to insert array element at
specific position</title>
</head>

<body>
<h2 style="color:hotpink">ArrayInsertAt Function Example</h2>

<cfset ColorArray = ArrayNew(1)>


<cfset Temp = ArrayAppend(ColorArray,"BurlyWood")>
<cfset Temp = ArrayAppend(ColorArray,"Chartreuse")>
<cfset Temp = ArrayAppend(ColorArray,"Chocolate")>
<cfdump var="#ColorArray#" label="Color Array">

<br />
<cfset Temp = ArrayInsertAt(ColorArray,2,"CadetBlue")>
<cfdump var="#ColorArray#" label="Color Array[After insert CadetBlue in
position 2]">
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/arrayinsertat-function-example-how-to.html
Example 9

ArrayDeleteAt function example: how to delete array element at


specific position
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ArrayDeleteAt function example: how to delete array element at
specific position</title>
</head>

<body>
<h2 style="color:hotpink">ArrayDeleteAt Function Example</h2>

<cfset NameArray = Arraynew(1)>


<cfset Temp = ArrayAppend(NameArray,"Ben")>
<cfset Temp = ArrayAppend(NameArray,"Rem")>
<cfset Temp = ArrayAppend(NameArray,"Jim")>
<cfset Temp = ArrayAppend(NameArray,"Jonson")>
<cfdump var="#NameArray#" label="NameArray">

<br />
<cfset Temp = ArrayDeleteAt(NameArray,2)>
<cfdump var="#NameArray#" label="NameArray[After delete position 2]">
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/arraydeleteat-function-example-how-to.html
Example 10

StructNew function example: how to create a structure

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>StructNew function example: how to create a structure</title>
</head>

<body>
<h2 style="color:HotPink">StructNew Function Example</h2>

<cfset Employee=StructNew()>
<cfset Employee.FirstName="Jenny">
<cfset Employee.LastName="Jones">

<cfdump var="#Employee#" label="Employee">


</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/structnew-function-example-how-to.html
Example 11

StructUpdate function example: how to update a structure key


with a value
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>StructUpdate function example: how to update a structure key with
a value</title>
</head>

<body>
<h2 style="color:HotPink">StructUpdate Function Example</h2>

<cfset Color=StructNew()>
<cfset Color.ID=1>
<cfset Color.Name="LightGray">
<cfset Color.Value="##D3D3D3">
<cfdump var="#Color#" label="Color">

<br />
<cfset Temp=StructUpdate(Color,"Name","LightGreen")>
<cfset Temp=StructUpdate(Color,"Value","##90EE90")>
<cfdump var="#Color#" label="Color[after update]">

</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/structupdate-function-example-how-to.html
Example 12

StructInsert function example: how to insert a key value pair


into a structure
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>StructInsert function example: how to insert a key value pair into
a structure</title>
</head>

<body>
<h2 style="color:HotPink">StructInsert Function Example</h2>
<cfset Color=StructNew()>
<cfdump var="#Color#" label="Color">

<cfset Temp=StructInsert(Color,"ID",1,"yes")>
<cfset Temp=StructInsert(Color,"Name","Green","yes")>
<cfset Temp=StructInsert(Color,"Value","##008000","yes")>

<br />
<cfdump var="#Color#" label="Color[after insert data]">

</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/structinsert-function-example-how-to.html
Example 13

StructFind function example: how to get (find) the value


associated with a key in a structure
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>StructFind function example: how to get (find) the value
associated with a key in a structure</title>
</head>

<body>
<h2 style="color:HotPink">StructFind Function Example</h2>

<cfset Color=StructNew()>
<cfset Color.ID=1>
<cfset Color.Name="LemonChiffon">
<cfset Color.Value="##FFFACD">
<cfdump var="#Color#" label="Color">

<br />
<cfset NameKey=StructFind(Color,"Name")>

<cfoutput>
<b>
Color Structure Name key: #NameKey#
</b>
</cfoutput>
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/structfind-function-example-how-to-get.html
Example 14

StructDelete function example: how to remove an element from


a structure
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>StructDelete function example: how to remove an element from a
structure</title>
</head>

<body>
<h2 style="color:HotPink">StructDelete Function Example</h2>

<cfset Color=StructNew()>
<cfset Color.ID=1>
<cfset Color.Name="LawnGreen">
<cfset Color.Value="##7CFC00">
<cfdump var="#Color#" label="Color">

<br />
<cfset Temp=StructDelete(Color,"Value")>
<cfdump var="#Color#" label="Color[after delete value key]">

</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/structdelete-function-example-how-to.html
Example 15

Duplicate function example: how to create a clone of a variable

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Duplicate function example: how to create a clone of a
variable</title>
</head>

<body>
<h2 style="color:HotPink">Duplicate Function Example</h2>

<cfset Color=StructNew()>
<cfset Color.ID=1>
<cfset Color.Name="Ivory">
<cfset Color.Value="##FFFFF0">
<cfdump var="#Color#" label="Color">

<br />
<cfset DuplicateColor=Duplicate(Color)>
<cfdump var="#DuplicateColor#" label="DuplicateColor">

<br />
<b>Change the Color structure---</b>
<br /><br />

<cfset Color.Name="Lavender">
<cfset Color.Value="##E6E6FA">

<cfdump var="#Color#" label="Color[after change color]">


<br />
<cfdump var="#DuplicateColor#" label="DuplicateColor[after change
color]">

<br />

</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/duplicate-function-example-how-to.html
Example 16

ListChangeDelims function example: how to change List


delimiter
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ListChangeDelims function example: how to change List
delimiter</title>
</head>

<body>
<h2 style="color:hotpink">ListChangeDelims Function Example</h2>

<cfset ColorList="DarkRed,DarkSalmon,DarkSeaGreen">
<cfoutput><b>ColorList: #Colorlist#</b></cfoutput>

<br />
<cfset Temp = ListChangeDelims(ColorList,";",",")>
<cfoutput><b>Temp[New Delimiter ;]: #Temp#</b></cfoutput>
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/listchangedelims-function-example-how.html
Example 17

ListDeleteAt function example: how to delete List element at


specific position
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ListDeleteAt function example: how to delete List element at
specific position</title>
</head>

<body>
<h2 style="color:hotpink">ListDeleteAt Function Example</h2>

<cfset ColorList="DarkSlateBlue,DarkSlateGray,DarkTurquoise">
<cfoutput><b>ColorList: #ColorList#</b></cfoutput>

<br /><br />


<cfset ColorList=ListDeleteAt(ColorList,2,",")>
<cfoutput><b>ColorList[After delete position 2]:
#ColorList#</b></cfoutput>
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/listdeleteat-function-example-how-to.html
Example 18

ListFind function example: how to find List element (case


sensitive)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ListFind function example: how to find List element (case
sensitive)</title>
</head>

<body>
<h2 style="color:hotpink">ListFind Function Example: Case-sensitive</h2>

<cfset ColorList="DarkViolet,DeepPink,DarkViolet,DeepSkyBlue">
<cfoutput><b>ColorList: #ColorList#</b></cfoutput>
<br /><br />

<table style="color:LightGreen; background:Green;" border="1"


bordercolor="DarkGreen">
<tr>
<td style="font-weight:bold">ListFind Case-sensitive</td>
<td style="font-weight:bold">Output</td>
</tr>
<tr>
<td>#ListFind(ColorList,"DarkViolet",",")#</td>
<td><cfoutput>#ListFind(ColorList,"DarkViolet",",")#</cfoutput></td>
</tr>
<tr>
<td>#ListFind(ColorList,"darkViolet",",")#</td>
<td><cfoutput>#ListFind(ColorList,"darkViolet",",")#</cfoutput></td>
</tr>
<tr>
<td>#ListFind(ColorList,"Red",",")#</td>
<td><cfoutput>#ListFind(ColorList,"Red",",")#</cfoutput></td>
</tr>
<tr>
<td>#ListFind(ColorList,"DeepSkyBlue",",")#</td>

<td><cfoutput>#ListFind(ColorList,"DeepSkyBlue",",")#</cfoutput></td>
</tr>
</table>

</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/listfind-function-example-how-to-find.html
Example 19

ListGetAt function example: how to get List element at a


specified position
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ListGetAt function example: how to get List element at a specified
position</title>
</head>

<body>
<h2 style="color:hotpink">ListGetAt Function Example</h2>

<cfset ColorList="FloralWhite,ForestGreen,Fuchsia,Gainsboro">
<cfoutput><b>ColorList: #ColorList#</b></cfoutput>

<br /><br />


<cfoutput><b>ColorList Element At Position 3:
#ListGetAt(ColorList,3,",")#</b></cfoutput>
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/listgetat-function-example-how-to-get.html
Example 20

ListInsertAt function example: how to insert an element in a


List at a specified position
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ListInsertAt function example: how to insert an element in a List
at a specified position</title>
</head>

<body>
<h2 style="color:hotpink">ListInsertAt Function Example</h2>

<cfset ColorList="GhostWhite,GoldenRod,Gray">
<cfoutput><b>ColorList: #ColorList#</b></cfoutput>

<br /><br />


<cfset ColorList=ListInsertAt(ColorList,2,"Gold",",")>
<cfoutput><b>ColorList[After insert Gold at position 2]:
#ColorList#</b></cfoutput>
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/listinsertat-function-example-how-to.html
Example 21

ListRest function example: how to get a List, withiout its first


element
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ListRest function example: how to get a List, withiout its first
element</title>
</head>

<body>
<h2 style="color:hotpink">ListRest Function Example</h2>

<cfset TagList="cfinterface,cfscript,cferror">
<cfoutput><b>TagList: #TagList#</b></cfoutput>

<br /><br />


<cfoutput><b>TagList[without first element]:
#ListRest(TagList,",")#</b></cfoutput>
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/listrest-function-example-how-to-get.html
Example 22

ListSort function example: how to sort List elements

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ListSort function example: how to sort List elements</title>
</head>

<body>
<h2 style="color:hotpink">ListSort Function Example</h2>

<cfset TagList="cfexchangemail,cffeed,cfapplication">
<cfoutput><b>TagList: #TagList#</b></cfoutput>

<br /><br />


<cfoutput>
<b>
TagList[sorted ascending]: #ListSort(TagList,"text","asc",",")#
<br />
TagList[sorted descending]: #ListSort(TagList,"text","desc",",")#
</b>
</cfoutput>
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/listsort-function-example-how-to-sort.html
Example 23

Hash function example: how to use Hash function with MD5


algorithm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Hash function example: how to use Hash function with MD5
algorithm</title>
</head>

<body>
<h2 style="color:Crimson">Hash Function Example: MD5</h2>

<cfset TestString="This is a string">


<cfset HashTestString=Hash(TestString,"MD5")>
<cfoutput>
<b>TestString:</b> #TestString#
<br />
<b>Hash TestString[algorithm MD5]:</b> #HashTestString#
</cfoutput>
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/hash-function-example-how-to-use-
hash_4123.html
Example 24

CreateDate function example: how to create a date object

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CreateDate function example: how to create a date object</title>
</head>

<body>
<h2 style="color:hotpink">CreateDate Function Example</h2>

<cfset Year="1971">
<cfset Month="12">
<cfset Day="16">
<cfset CreatedDate=CreateDate(Year,Month,Day)>
<cfoutput>
<b>
Year: #Year#
<br />
Month: #Month#
<br />
Day: #Day#
<br /><br />
Created Date: #CreatedDate#
<br />
Created Date: #DateFormat(CreatedDate)#
</b>
</cfoutput>
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/createdate-function-example-how-to.html
Example 25

CreateDateTime function example: how to create a date time


object
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CreateDateTime function example: how to create a date time
object</title>
</head>

<body>
<h2 style="color:hotpink">CreateDateTime Function Example</h2>

<cfset Year="2008">
<cfset Month="12">
<cfset Day="5">
<cfset Hour="6">
<cfset Minute="30">
<cfset Second="29">
<cfset CreatedDateTime=CreateDateTime(Year,Month,Day,Hour,Minute,Second)>
<cfoutput>
<b>
Year: #Year#
<br />
Month: #Month#
<br />
Day: #Day#
<br />
Hour: #Hour#
<br />
Minute: #Minute#
<br />
Second: #Second#
<br /><br />
Created DateTime: #CreatedDateTime#
</b>
</cfoutput>
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/createdatetime-function-example-how-to.html
Example 26

CreateTimeSpan function example: how to create a time span

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CreateTimeSpan function example: how to create a time span</title>
</head>

<body>
<h2 style="color:hotpink">CreateTimeSpan Function Example</h2>

<cfquery name="qEmployee" datasource="cfdocexamples"


cachedwithin="#CreateTimeSpan(0,0,30,0)#" result="Employee">
SELECT Emp_ID, FirstName, LastName FROM EMPLOYEE
</cfquery>

<cfdump var="#Employee#">
<br />
<b>Query result catched for 30 minute TimeSpan</b>
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/createtimespan-function-example-how-to.html
Example 27

DateAdd function example: how to add year, quarter, month,


week, day, hour, minute, second to a date
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>DateAdd function example: how to add year, quarter, month, week,
day, hour, minute, second to a date</title>
</head>

<body>
<h2 style="color:hotpink">DateAdd Function Example</h2>
<cfset MyDateTime=Now()>
<cfoutput>
<b>
MyDateTime: #MyDateTime#
<br />
MyDateTime: #DateFormat(MyDateTime)#
</b>
<br /><br />
</cfoutput>

<table style="color:LightGreen; background:Green;" border="1"


bordercolor="DarkGreen">
<tr>
<td style="font-weight:bold">DateAdd</td>
<td style="font-weight:bold">DatePart</td>
<td style="font-weight:bold">Output</td>
</tr>
<tr>
<td>#DateFormat(DateAdd("yyyy",1,MyDateTime))#</td>
<td>Year</td>

<td><cfoutput>#DateFormat(DateAdd("yyyy",1,MyDateTime))#</cfoutput></td>
</tr>
<tr>
<td>#DateFormat(DateAdd("q",1,MyDateTime))#</td>
<td>Quarter</td>

<td><cfoutput>#DateFormat(DateAdd("q",1,MyDateTime))#</cfoutput></td>
</tr>
<tr>
<td>#DateFormat(DateAdd("m",1,MyDateTime))#</td>
<td>Month</td>

<td><cfoutput>#DateFormat(DateAdd("m",1,MyDateTime))#</cfoutput></td>
</tr>
<tr>
<td>#DateFormat(DateAdd("y",1,MyDateTime))#</td>
<td>Day of year</td>
<td><cfoutput>#DateFormat(DateAdd("y",1,MyDateTime))#</cfoutput></td>
</tr>
<tr>
<td>#DateFormat(DateAdd("w",2,MyDateTime))#</td>
<td>Weekday</td>

<td><cfoutput>#DateFormat(DateAdd("w",2,MyDateTime))#</cfoutput></td>
</tr>
<tr>
<td>#DateFormat(DateAdd("ww",1,MyDateTime))#</td>
<td>Week</td>

<td><cfoutput>#DateFormat(DateAdd("ww",1,MyDateTime))#</cfoutput></td>
</tr>
<tr>
<td>#DateAdd("h",1,MyDateTime)#</td>
<td>Hour</td>
<td><cfoutput>#DateAdd("h",1,MyDateTime)#</cfoutput></td>
</tr>
<tr>
<td>#DateAdd("n",1,MyDateTime)#</td>
<td>Minute</td>
<td><cfoutput>#DateAdd("n",1,MyDateTime)#</cfoutput></td>
</tr>
<tr>
<td>#DateAdd("s",10,MyDateTime)#</td>
<td>Second</td>
<td><cfoutput>#DateAdd("s",10,MyDateTime)#</cfoutput></td>
</tr>
</table>

</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/dateadd-function-example-how-to-add.html
Example 28

DateCompare function example: how to compare two date time


object
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>DateCompare function example: how to compare two date time
object</title>
</head>

<body>
<h2 style="color:hotpink">DateCompare Function Example</h2>

<cfset MyDate="3-Dec-2008">
<cfset MyAnotherDate="5-Dec-2008">
<cfoutput>
<b>
MyDate: #MyDate#
<br />
MyAnotherDate: #MyAnotherDate#
</b><br />
</cfoutput>
<cfset DateCompareResult=DateCompare(myDate,MyAnotherDate)>
<cfif DateCompareResult EQ 0>
Two date is same
<cfelseif DateCompareResult LT 0>
MyDate is earlier than MyAnotherDate
<cfelse>
MyDate is later than MyAnotherDate
</cfif>

<br /><br />


<cfset MyDate="8-Dec-2008">
<cfset MyAnotherDate="5-Dec-2008">
<cfoutput>
<b>
MyDate: #MyDate#
<br />
MyAnotherDate: #MyAnotherDate#
</b><br />
</cfoutput>
<cfset DateCompareResult=DateCompare(myDate,MyAnotherDate)>
<cfif DateCompareResult EQ 0>
Two date is same
<cfelseif DateCompareResult LT 0>
MyDate is earlier than MyAnotherDate
<cfelseif DateCompareResult EQ 1>
MyDate is later than MyAnotherDate
</cfif>
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/datecompare-function-example-how-to.html
Example 29

DateDiff function example: how to get difference between two


date time object
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>DateDiff function example: how to get difference between two date
time object</title>
</head>

<body>
<h2 style="color:hotpink">DateDiff Function Example</h2>

<cfset MyDate="8-Dec-2006">
<cfset MyAnotherDate="10-Dec-2007">

<cfoutput>
<b>
MyDate: #MyDate#
<br />
MyAnotherDate: #MyAnotherDate#
<br /><br />
</b>
</cfoutput>
<table style="color:LightGreen; background:Green;" border="1"
bordercolor="DarkGreen">
<tr>
<td style="font-weight:bold">DateDiff</td>
<td style="font-weight:bold">DatePart</td>
<td style="font-weight:bold">Output</td>
</tr>
<tr>
<td>#DateDiff("yyyy",MyDate,MyAnotherDate)#</td>
<td>Years</td>

<td><cfoutput>#DateDiff("yyyy",MyDate,MyAnotherDate)#</cfoutput></td>
</tr>
<tr>
<td>#DateDiff("q",MyDate,MyAnotherDate)#</td>
<td>Quarters</td>
<td><cfoutput>#DateDiff("q",MyDate,MyAnotherDate)#</cfoutput></td>
</tr>
<tr>
<td>#DateDiff("m",MyDate,MyAnotherDate)#</td>
<td>Months</td>
<td><cfoutput>#DateDiff("m",MyDate,MyAnotherDate)#</cfoutput></td>
</tr>
<tr>
<td>#DateDiff("d",MyDate,MyAnotherDate)#</td>
<td>Days</td>
<td><cfoutput>#DateDiff("d",MyDate,MyAnotherDate)#</cfoutput></td>
</tr>
</table>

</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/datediff-function-example-how-to-get.html
Example 30

DatePart function example: how to get a part from a date value

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>DatePart function example: how to get a part from a date
value</title>
</head>

<body>
<h2 style="color:hotpink">DatePart Function Example</h2>

<cfset MyDate=Now()>

<cfoutput>
<b>
MyDate: #MyDate#
<br /><br />
</b>
</cfoutput>
<table style="color:LightGreen; background:Green;" border="1"
bordercolor="DarkGreen">
<tr>
<td style="font-weight:bold">DatePart</td>
<td style="font-weight:bold"></td>
<td style="font-weight:bold">Output</td>
</tr>
<tr>
<td>#DatePart("yyyy",MyDate)#</td>
<td>Years</td>
<td><cfoutput>#DatePart("yyyy",MyDate)#</cfoutput></td>
</tr>
<tr>
<td>#DatePart("q",MyDate)#</td>
<td>Quarter</td>
<td><cfoutput>#DatePart("q",MyDate)#</cfoutput></td>
</tr>
<tr>
<td>#DatePart("m",MyDate)#</td>
<td>Month</td>
<td><cfoutput>#DatePart("m",MyDate)#</cfoutput></td>
</tr>
<tr>
<td>#DatePart("y",MyDate)#</td>
<td>Day of Year</td>
<td><cfoutput>#DatePart("y",MyDate)#</cfoutput></td>
</tr>
<tr>
<td>#DatePart("w",MyDate)#</td>
<td>Weekday</td>
<td><cfoutput>#DatePart("w",MyDate)#</cfoutput></td>
</tr>
<tr>
<td>#DatePart("ww",MyDate)#</td>
<td>Week</td>
<td><cfoutput>#DatePart("ww",MyDate)#</cfoutput></td>
</tr>
<tr>
<td>#DatePart("yyyy",MyDate)#</td>
<td>Years</td>
<td><cfoutput>#DatePart("yyyy",MyDate)#</cfoutput></td>
</tr>
<tr>
<td>#DatePart("h",MyDate)#</td>
<td>Hour</td>
<td><cfoutput>#DatePart("h",MyDate)#</cfoutput></td>
</tr>
<tr>
<td>#DatePart("n",MyDate)#</td>
<td>Minute</td>
<td><cfoutput>#DatePart("n",MyDate)#</cfoutput></td>
</tr>
<tr>
<td>#DatePart("s",MyDate)#</td>
<td>Second</td>
<td><cfoutput>#DatePart("s",MyDate)#</cfoutput></td>
</tr>
<tr>
<td>#DatePart("l",MyDate)#</td>
<td>Millisecond</td>
<td><cfoutput>#DatePart("l",MyDate)#</cfoutput></td>
</tr>
</table>

</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/datepart-function-example-how-to-get.html
Example 31

GetTickCount function example: how to get the system time in


milliseconds
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>GetTickCount function example: how to get the system time in
milliseconds</title>
</head>

<body>
<h2 style="color:hotpink">GetTickCount Function Example</h2>

<cfset StartTick=GetTickCount()>
<cfoutput><b>StartTick: #StartTick#</b></cfoutput>
<br /><br />

Loop start...[1-1000000]
<br />
<cfloop index="i" from="1" to="1000000" step="1">
</cfloop>
Loop end...
<br /><br />

<cfset EndTick=GetTickCount()>
<cfoutput><b>EndTick: #EndTick#</b></cfoutput>
<br /><br />

Loop Time: <cfoutput>#StartTick-EndTick# milliseconds</cfoutput>

</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/gettickcount-function-example-how-to.html
Example 32

DE function example: how to escape any double-quotation


marks in the parameter and wraps the result in double-
quotation marks
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>DE function example: how to escape any double-quotation marks in
the parameter and wraps the result in double-quotation marks</title>
</head>

<body>
<h2 style="color:Crimson">DE Function Example</h2>

<cfquery name="qBook" datasource="cfbookclub">


SELECT BookID, Title FROM BOOKS
</cfquery>

<table cellpadding="0" cellspacing="0">


<tr bgcolor="Green" align="center">
<td><b>BookID</b></td>
<td><b>Title</b></td>
</tr>
<cfloop query="qBook">
<cfoutput>
<tr bgcolor="#IIF(qBook.CurrentRow mod 2 eq 0,
DE("Pink"),DE("HotPink"))#">
<td>#BookID#</td>
<td>#Title#</td>
</tr>
</cfoutput>
</cfloop>
</table>
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/de-function-example-how-to-escape-any.html
Example 33

SetVariable function example: how to set a variable with name


and value
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SetVariable function example: how to set a variable with name and
value</title>
</head>

<body>
<h2 style="color:Crimson">SetVariable Function Example</h2>

<cfset MyID=5>
<cfset Setvariable("ID" & MyID,"Jones" )>
<cfset SetVariable("City","Rome")>
<cfoutput>
<b>ID5:</b> #ID5#
<br />
<b>City:</b> #City#
</cfoutput>

</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/setvariable-function-example-how-to-set.html
Example 34

WriteOutput function example: how to append text to the page


output stream
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>WriteOutput function example: how to append text to the page
output stream</title>
</head>

<body>
<h2 style="color:Crimson">WriteOutput Function Example</h2>

<cfscript>
Value1=10;
value2=15;
Value3=25;
Sum=Value1+Value2+Value3;
WriteOutput("<b>Value1</b>" & "=" & Value1 & "<br/>");
WriteOutput("<b>Value2</b>" & "=" & Value2 & "<br/>");
WriteOutput("<b>Value3</b>" & "=" & Value3 & "<br/>");
WriteOutput("<b>Value1+Value2+Value3</b>= "& Sum);
</cfscript>
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/writeoutput-function-example-how-to.html
Example 35

QueryNew function example: how to create an empty query


(query object)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>QueryNew function example: how to create an empty query (query
object)</title>
</head>

<body>
<h2 style="color:HotPink">QueryNew Function Example</h2>

<cfset qEmployee=QueryNew("EmployeeID, FirstName, LastName","Integer,


VarChar, VarChar")>

<cfset Temp=QueryAddRow(qEmployee,1)>

<cfset Temp=QuerySetCell(qEmployee,"EmployeeID",1,1)>
<cfset Temp=QuerySetCell(qEmployee,"FirstName","Jenny",1)>
<cfset Temp=QuerySetCell(qEmployee,"LastName","Jones",1)>

<cfdump var="#qEmployee#" label="empty query">

</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/querynew-function-example-how-to-create.html
Example 36

Find function example: how to find the first occurence of a


substring in a string (case sensitive)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Find function example: how to find the first occurence of a
substring in a string (case sensitive)</title>
</head>

<body>
<h2 style="color:hotpink">Find Function Example [Case sensitive]</h2>

<cfset MyString="Finds the first occurrence of a substring in a string,


from a specified start position.">
<cfoutput>
<b>MyString:</b> #MyString#
<br />
<b>
MyString[find "string"]: #Find("string",MyString,0)#
</b>
</cfoutput>

<br /><br />


<cfset MyString="Finds the first occurrence of a substring in a string,
from a specified start position.">
<cfoutput>
<b>MyString:</b> #MyString#
<br />
<b>
MyString[find "f"]: #Find("f",MyString,0)#
</b>
</cfoutput>

</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/find-function-example-how-to-find-first.html
Example 37

RemoveChars function example: how to remove characters from


a string
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>RemoveChars function example: how to remove characters from a
string</title>
</head>

<body>
<h2 style="color:HotPink">RemoveChars Function Example</h2>

<cfset TestString="Test string for RemoveChars function">


<cfoutput>
<b>
TestString: #TestString#
<br />
TestString[after remove substring start 6, count 6]:
#RemoveChars(TestString,6,6)#
</b>
</cfoutput>

</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/removechars-function-example-how-to.html
Example 38

Replace function example: how to replace a substring in a


string (case sensitive)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Replace function example: how to replace a substring in a string
(case sensitive)</title>
</head>

<body>
<h2 style="color:HotPink">Replace Function Example [case sensitive]</h2>

<cfset TestString="This is test string. this is test. Only Test">


<cfoutput>
<b>
TestString: #TestString#
<br />
TestString[after replace substring "test" with "simple" first ]:
#Replace(TestString,"test","simple","one")#
<br />
TestString[after replace substring "test" with "simple" all ]:
#Replace(TestString,"test","simple","all")#

</b>
</cfoutput>

</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/replace-function-example-how-to-replace.html
Example 39

GetMetricData function example: how to get server parformace


metrics
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>GetMetricData function example: how to get server parformace
metrics</title>
</head>

<body>
<h2 style="color:Crimson">GetMetricData Function Example</h2>

<cfset MetricDataPERF=GetMetricData("perf_monitor")>
<cfdump var="#MetricDataPERF#" label="Metric Data[perf_monitor]">

<cfset MetricDataSimpleLoad=GetMetricData("simple_load")>
<cfset MetricDataPreviousReqTime=GetMetricData("prev_req_time")>
<cfset MetricDataAvgReqTime=GetMetricData("avg_req_time")>

<cfoutput>
<b>MetricData Simple Load[simple_load]:</b> #MetricDataSimpleLoad#
<br />
<b>MetricData Previuos Request Time[prev_req_time]:</b>
#MetricDataPreviousReqTime#
<br />
<b>MetricData Avarage Request Time[avg_req_time]:</b>
#MetricDataAvgReqTime#
</cfoutput>

</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/getmetricdata-function-example-how-to.html
Example 40

ImageNew function example: how to create a coldfusion image

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ImageNew function example: how to create a coldfusion
image</title>
</head>

<body>
<h2 style="color:Crimson">ImageNew Function Example</h2>

<cfset TestImage=ImageNew("",250,250,"rgb","red")>
<cfset ImageDrawText(TestImage,"A New Image",75,25)>
<cfimage action="WriteToBrowser" source="#TestImage#">
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/imagenew-function-example-how-to-create.html
Example 41

cfargument tag example: how to use cfargument tag in


cffunction tag
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfargument tag example: how to use cfargument tag in cffunction
tag</title>
</head>

<body>
<h2 style="color:Crimson">cfargument Tag Example</h2>

<cfoutput>
<b>Book Title [BookID 1]:</b> #GetBookTitleByID(1)#
<br />
<b>Book Title [BookID 10]:</b> #GetBookTitleByID(10)#
<br />
<b>Book Title [BookID 15]:</b> #GetBookTitleByID(15)#
<br />
<b>Book Title [BookID 20]:</b> #GetBookTitleByID(20)#
</cfoutput>

<cffunction name="GetBookTitleByID" access="remote" returntype="string"


description="Return Book Title by ID">
<cfargument name="BookID" type="numeric" required="yes">
<cfquery name="qBook" datasource="cfbookclub">
SELECT Title FROM BOOKS
WHERE BookID=#arguments.BookID#
</cfquery>
<cfreturn qBook.Title>
</cffunction>
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/cfargument-tag-example-how-to-use.html
Example 42

cfcalendar tag: how to set change month names in calendar in


coldfusion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfcalendar tag: how to set change month names in calendar in
coldfusion</title>
</head>

<body>
<h2 style="color:DodgerBlue; font-style:italic">cfcalendar tag example:
how to use monthnames attribute</h2>
<hr width="575" align="left" color="CornFlowerBlue" />
<br />

<cfif IsDefined("Form.SubmitNextMeetingDate")>
<cfoutput>
<h3 style="color:OrangeRed;">
Next Meeting Date Is: #DateFormat(Form.MeetingDate)#
</h3>
</cfoutput>
</cfif>

<cfform name="CalendarMonthNamesTest" method="post" format="html">


<table border="1" cellpadding="5" cellspacing="0"
bordercolor="CornFlowerBlue">
<tr>
<td colspan="2" bgcolor="DodgerBlue" style="color:Snow; font-
size:large" align="center">
Next Meeting Date Submit Form
</td>
</tr>
<tr valign="top">
<td style="color:DodgerBlue; font-weight:bold">
Next Meeting Date
</td>
<td >
<cfcalendar
name="MeetingDate"
monthnames="Jan, Feb, March, April, May, Jun, July,
August, September, October, November, December"
/>
</td>
</tr>
<tr>
<td colspan="2" align="right">
<cfinput
name="SubmitNextMeetingDate"
type="submit"
value="Submit Date"
style="height:45px; width:150px; font-size:large;
font-style:italic; font-weight:bold; color:DodgerBlue;"
>
</td>
</tr>
</table>
</cfform>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/06/cfcalendar-tag-how-to-set-change-month.html
Example 43

cfcalendar tag: how to set change first day of week in calendar


control
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfcalendar tag: how to set change first day of week in calendar
control</title>
</head>

<body>
<h2 style="color:SeaGreen; font-style:italic">cfcalendar tag example: how
to use firstdayofweek attribute</h2>
<hr width="575" align="left" color="SeaGreen" />
<br />

<cfif IsDefined("Form.SubmitJoiningDate")>
<cfoutput>
<h3 style="color:IndianRed;">
Your joining date is: #DateFormat(Form.JoiningDate)#
</h3>
</cfoutput>
</cfif>

<cfform name="CalendarFirstDayOfWeekTest" method="post" format="html">


<table border="1" cellpadding="5" cellspacing="0"
bordercolor="SeaGreen">
<tr>
<td colspan="2" bgcolor="DarkSeaGreen" style="color:Snow; font-
size:large" align="center">
Joining Date Submit Form
</td>
</tr>
<tr valign="top">
<td style="color:DarkSeaGreen; font-weight:bold">
Joining Date
</td>
<td >
<cfcalendar
name="JoiningDate"
firstdayofweek="3"
/>
</td>
</tr>
<tr>
<td colspan="2" align="right">
<cfinput
name="SubmitJoiningDate"
type="submit"
value="Submit Date"
style="height:45px; width:150px; font-size:large;
font-style:italic; font-weight:bold; color:DarkSeaGreen;"
>
</td>
</tr>
</table>
</cfform>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/06/cfcalendar-tag-how-to-set-change-first.html
Example 44

cfcalendar tag: how to set change day names of calendar


control in coldfusion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfcalendar tag: how to set change day names of calendar control in
coldfusion</title>
</head>

<body>
<h2 style="color:SeaGreen; font-style:italic">cfcalendar tag example: how
to use daynames attribute</h2>
<hr width="575" align="left" color="OrangeRed" />
<br />

<cfif IsDefined("Form.SubmitArrivalDate")>
<cfoutput>
<h3 style="color:OrangeRed;">
Your arrival date is: #DateFormat(Form.ArrivalDate)#
</h3>
</cfoutput>
</cfif>

<cfform name="CalendarDayNamesTest" method="post" format="html">


<table border="1" cellpadding="5" cellspacing="0" bordercolor="Orange">
<tr>
<td colspan="2" bgcolor="DeepPink" style="color:Snow; font-
size:large" align="center">
Arrival Date Submit Form
</td>
</tr>
<tr valign="top">
<td style="color:RosyBrown; font-weight:bold">
Arrival Date
</td>
<td>
<cfcalendar
name="ArrivalDate"
required="yes"
daynames="Su, M, T, W, Th, F, Sa"
/>
</td>
</tr>
<tr>
<td colspan="2" align="right">
<cfinput
name="SubmitArrivalDate"
type="submit"
value="Submit Date"
style="height:45px; width:150px; font-size:large;
font-style:italic; font-weight:bold; color:OrangeRed;"
>
</td>
</tr>
</table>
</cfform>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/06/cfcalendar-tag-how-to-set-change-day.html
Example 45

cfcalendar tag: how to disable date range (startRange,


endrange) in calendar in coldfusion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfcalendar tag: how to disable date range (startRange, endrange)
in calendar in coldfusion</title>
</head>

<body>
<h2 style="color:OliveDrab; font-style:italic">cfcalendar tag example:
how to use startrange, endrange attribute</h2>
<hr width="625" align="left" color="Olive" />
<br />

<cfif IsDefined("Form.SubmitClassDate")>
<cfoutput>
<h3 style="color:DarkSeaGreen;">
Next Class Date Is: #DateFormat(Form.ClassDate)#
</h3>
</cfoutput>
</cfif>

<cfform name="CalendarStartRangeEndRangeTest" method="post"


format="html">
<table border="1" cellpadding="5" cellspacing="0" bordercolor="Olive">
<tr>
<td colspan="2" bgcolor="OliveDrab" style="color:Snow; font-
size:large" align="center">
Next Class Date Submit Form
</td>
</tr>
<tr valign="top">
<td style="color:OliveDrab; font-weight:bold">
Next Class Date
</td>
<td >
<cfcalendar
name="ClassDate"
startrange="#Now()#"
endrange="#DateAdd('d',4,Now())#"
/>
</td>
</tr>
<tr>
<td colspan="2" align="right">
<cfinput
name="SubmitClassDate"
type="submit"
value="Submit Date"
style="height:45px; width:150px; font-size:large;
font-style:italic; font-weight:bold; color:OliveDrab;"
>
</td>
</tr>
</table>
</cfform>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/06/cfcalendar-tag-how-to-disable-date.html
Example 46

cfchart tag: how to create and design pie type chart in


coldfusion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfchart tag: how to create and design pie type chart in
coldfusion</title>
</head>

<body>
<h2 style="color:BlueViolet; font-style:italic">cfchart example: pie type
chart</h2>
<hr width="675" align="left" color="BlueViolet" />
<br />

<cfchart
format="jpg"
chartheight="375"
databackgroundcolor="FFE4E1"
chartwidth="675"
backgroundcolor="EEE8AA"
fontbold="yes"
foregroundcolor="FF4500"
fontsize="13"
show3d="yes"
font="Comic Sans MS"
showborder="no"
pieslicestyle="sliced"
>
<cfchartseries
type="pie"
>
<cfchartdata item="Sam" value="1250">
<cfchartdata item="Ray" value="1750">
<cfchartdata item="Sonia" value="2150">
<cfchartdata item="Suzon" value="850">
<cfchartdata item="Taz" value="950">
</cfchartseries>
</cfchart>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cfchart-tag-how-to-create-and-
design_3917.html
Example 47

cfchart tag: how to use cfchart without query in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfchart tag: how to use cfchart without query in
coldfusion</title>
</head>

<body>
<h2 style="color:MediumAquaMarine; font-style:italic">cfchart example:
how to use cfchart without query</h2>
<hr width="700" align="left" color="LightPink" />
<br />

<cfchart
format="png"
xaxistitle="First Name"
yaxistitle="Salary"
chartheight="400"
chartwidth="700"
backgroundcolor="D8BFD8"
foregroundcolor="FFFAFA"
fontbold="yes"
show3d="yes"
databackgroundcolor="FFEBCD"
font="Verdana"
fontsize="13"
showxgridlines="no"
showygridlines="yes"
sortxaxis="yes"
showborder="no"
>
<cfchartseries
type="bar"
seriescolor="FF6347"
>
<cfchartdata item="Jen" value="1200">
<cfchartdata item="Jhon" value="1500">
<cfchartdata item="Bill" value="1800">
<cfchartdata item="Ben" value="2000">
<cfchartdata item="Sonia" value="900">
</cfchartseries>
</cfchart>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cfchart-tag-how-to-use-cfchart-without.html
Example 48

cfchart tag: how to use colorlist in pie chart in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfchart tag: how to use colorlist in pie chart in
coldfusion</title>
</head>

<body>
<h2 style="color:DarkOliveGreen; font-style:italic">cfchart example: how
to use colorlist in pie chart</h2>
<hr width="700" align="left" color="LightPink" />
<br />

<cfquery name="qEmployee" datasource="cfdocexamples" maxrows="5">


SELECT FirstName, LastName, Salary FROM EMPLOYEE
</cfquery>

<cfchart
format="png"
xaxistitle="First Name"
yaxistitle="Salary"
chartheight="400"
chartwidth="700"
showlegend="yes"
fontbold="yes"
backgroundcolor="BC8F8F"
foregroundcolor="FFFAFA"
show3d="yes"
databackgroundcolor="8FBC8F"
font="Verdana"
fontsize="13"
showxgridlines="no"
showygridlines="yes"
>
<cfchartseries
query="qEmployee"
type="pie"
colorlist="FFE4E1,FFEFD5,D2B48C,FFDAB9,F5DEB3"
itemcolumn="FirstName"
valuecolumn="Salary"
>
</cfchartseries>
</cfchart>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cfchart-tag-how-to-use-colorlist-in-pie.html
Example 49

cfchart tag: how to use xoffset and yoffset in chart in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfchart tag: how to use xoffset and yoffset in chart in
coldfusion</title>
</head>

<body>
<h2 style="color:GoldenRod; font-style:italic">cfchart example: how to
use xoffset and yoffset in chart</h2>
<hr width="700" align="left" color="LightPink" />
<br />

<cfquery name="qEmployee" datasource="cfdocexamples" maxrows="4">


SELECT FirstName, LastName, Salary FROM EMPLOYEE
</cfquery>

<cfchart
format="png"
xaxistitle="First Name"
yaxistitle="Salary"
chartheight="400"
chartwidth="700"
showlegend="no"
backgroundcolor="808080"
foregroundcolor="FFFAFA"
fontbold="yes"
show3d="yes"
databackgroundcolor="D2B48C"
font="Verdana"
fontsize="13"
showxgridlines="no"
showygridlines="yes"
xoffset="0.3"
yoffset="0.2"
>
<cfchartseries
query="qEmployee"
type="bar"
itemcolumn="FirstName"
valuecolumn="Salary"
seriescolor="F5DEB3"
>
</cfchartseries>
</cfchart>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cfchart-tag-how-to-use-xoffset-and.html
Example 50

cfchartdata tag: how to use cfchartdata with cfchartseries and


cfchart in coldfusion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfchartdata tag: how to use cfchartdata with cfchartseries and
cfchart in coldfusion</title>
</head>

<body>
<h2 style="color:SlateGray; font-style:italic">cfchartdata example: how
to use</h2>
<hr width="700" align="left" color="SlateGray" />
<br />

<cfquery name="qEmployee" datasource="cfdocexamples" maxrows="7">


SELECT FirstName, LastName, Salary FROM EMPLOYEE
</cfquery>

<cfchart
format="jpg"
xaxistitle="First Name"
yaxistitle="Salary"
chartheight="400"
chartwidth="700"
fontbold="yes"
backgroundcolor="DEB887"
foregroundcolor="FFFFFF"
show3d="yes"
databackgroundcolor="FFFAFA"
fontsize="13"
>
<cfchartseries
query="qEmployee"
type="cone"
itemcolumn="FirstName"
valuecolumn="Salary"
seriescolor="9ACD32"
>
<cfchartdata item="Test" value="150000">
</cfchartseries>
</cfchart>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cfchartdata-tag-how-to-use-cfchartdata.html
Example 51

cfchart tag: how to use 3d chart in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfchart tag: how to use 3d chart in coldfusion</title>
</head>

<body>
<h2 style="color:Crimson; font-style:italic">cfchart example: how to use
3d chart</h2>
<hr width="700" align="left" color="LightPink" />
<br />

<cfquery name="qEmployee" datasource="cfdocexamples" maxrows="10">


SELECT FirstName, LastName, Salary FROM EMPLOYEE
</cfquery>

<cfchart
format="png"
xaxistitle="First Name"
chartheight="400"
chartwidth="700"
yaxistitle="Salary"
showlegend="no"
backgroundcolor="E9967A"
labelformat="currency"
foregroundcolor="FFFAFA"
fontbold="yes"
show3d="yes"
databackgroundcolor="FF4500"
font="Verdana"
fontsize="13"
showxgridlines="no"
showygridlines="yes"
>
<cfchartseries
query="qEmployee"
type="curve"
itemcolumn="FirstName"
valuecolumn="Salary"
>
</cfchartseries>
</cfchart>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cfchart-tag-how-to-use-3d-chart-in.html
Example 52

cfchart tag: how to create chart and use cfchart in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfchart tag: how to create chart and use cfchart in
coldfusion</title>
</head>

<body>
<h2 style="color:DimGray; font-style:italic">cfchart example: how to
use</h2>
<hr width="700" align="left" color="DimGray" />
<br />

<cfquery name="qEmployee" datasource="cfdocexamples" maxrows="7">


SELECT FirstName, LastName, Salary FROM EMPLOYEE
</cfquery>

<cfchart
format="jpg"
xaxistitle="First Name"
yaxistitle="Salary"
chartheight="400"
chartwidth="700"
backgroundcolor="708090"
foregroundcolor="F5F5F5"
fontbold="yes"
fontitalic="yes"
font="Verdana"
fontsize="13"
show3d="yes"
labelformat="currency"
showxgridlines="no"
>
<cfchartseries
query="qEmployee"
type="bar"
itemcolumn="FirstName"
valuecolumn="Salary"
seriescolor="D8BFD8"
>
</cfchartseries>
</cfchart>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cfchart-tag-how-to-create-chart-and-use.html
Example 53

cfdirectory tag: how to create directory programmatically

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion cfdirectory tag example: how to create directory
programmatically</title>
</head>

<body>
<h2 style="color:DodgerBlue">ColdFusion cfdirectory tag example:
Create</h2>

<cfset CurrentDirectory=GetTemplatePath()>
<cfset CurrentDirectory =
ListDeleteAt(CurrentDirectory,ListLen(CurrentDirectory,"/\"),"/\")>
<cfset NewDirectory="#CurrentDirectory#\TestFolder">

<cfoutput>
<b>Current Directory:</b> #CurrentDirectory#
<br />
<b>New Directory:</b> #NewDirectory#
</cfoutput>

<cfdirectory action="create" directory="#NewDirectory#">


</body>
</html>
http://coldfusion-example.blogspot.com/2009/02/cfdirectory-tag-how-to-create-directory.html
Example 54

cfdirectory tag: how to get file and directory list under a


directory
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion cfdirectory tag example: how to get file and directory
list under a directory</title>
</head>

<body>
<h2 style="color:DodgerBlue">ColdFusion cfdirectory tag example:
List</h2>

<cfset CurrentDirectory=GetTemplatePath()>
<cfset CurrentDirectory =
ListDeleteAt(CurrentDirectory,ListLen(CurrentDirectory,"/\"),"/\")>

<cfoutput>
<b>Current Directory:</b> #CurrentDirectory#
<br />
</cfoutput>

<cfdirectory action="list" directory="#CurrentDirectory#" name="result">


<cfdump var="#result#">

</body>
</html>
http://coldfusion-example.blogspot.com/2009/02/cfdirectory-tag-how-to-get-file-and.html
Example 55

cfdirectory tag: how to get specific extension file list under a


directory
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion cfdirectory tag example: how to get specific extension
file list under a directory</title>
</head>

<body>
<h2 style="color:DodgerBlue">cfdirectory example: Specific Extension
File List</h2>

<cfset RootDirectory=GetTemplatePath()>
<cfset RootDirectory =
ListDeleteAt(RootDirectory,ListLen(RootDirectory,"/\"),"/\")>

<cfoutput>
<b>Root Directory:</b> #RootDirectory#
<br />
</cfoutput>

<cfdirectory
action="list"
directory="#RootDirectory#"
name="result" filter="*.cfm"
>

<cfdump var="#result#">

</body>
</html>
http://coldfusion-example.blogspot.com/2009/03/cfdirectory-tag-how-to-get-specific.html
Example 56

cfdocument tag: how to create printable document in


coldfusion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfdocument tag: how to create printable document in
coldfusion</title>
</head>

<body>

<cfquery name="qEmployee" datasource="cfdocexamples" maxrows="10">


SELECT Emp_ID, FirstName, LastName, Salary FROM EMPLOYEE
</cfquery>

<cfdocument format="flashpaper">
<h2 style="color:Crimson; font-style:italic">
cfdocument example: employee data
</h2>
<cftable query="qEmployee" colheaders="yes" htmltable="no" border="yes">
<cfcol header="ID" text="#Emp_ID#">
<cfcol header="First Name" text="#FirstName#">
<cfcol header="Last Name" text="#LastName#">
<cfcol header="Salary" text="#Salary#">
</cftable>
</cfdocument>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cfdocument-tag-how-to-create-printable.html
Example 57

cfdocument scope currentpagenumber: how to show current


page number in printable document
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfdocument scope currentpagenumber: how to show current page
number in printable document</title>
</head>

<body>

<cfquery name="qEmployee" datasource="cfdocexamples" maxrows="10">


SELECT Emp_ID, FirstName, LastName, Salary FROM EMPLOYEE
</cfquery>

<cfdocument format="pdf">
<cfoutput>
<cfdocumentitem type="header">
Current Page Number: #cfdocument.currentpagenumber#
</cfdocumentitem>

<cfdocumentsection>
<h3 style="color:Crimson; font-style:italic">
cfdocument scope example: currentpagenumber
</h3>
<cftable query="qEmployee" colheaders="yes" htmltable="no"
border="no">
<cfcol header="ID" text="#Emp_ID#">
<cfcol header="First Name" text="#FirstName#">
<cfcol header="Last Name" text="#LastName#">
<cfcol header="Salary" text="#Salary#">
</cftable>
<cfdocumentitem type="pagebreak">
</cfdocumentitem>
<h3 style="color:DimGray; font-style:italic">
This is another page
</h3>
</cfdocumentsection>
</cfoutput>
</cfdocument>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cfdocument-scope-currentpagenumber-how.html
Example 58

cfdocument scope currentsectionpagenumber: how to show


current section page number in printable document
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfdocument scope currentsectionpagenumber: how to show current
section page number in printable document</title>
</head>

<body>

<cfquery name="qEmployee" datasource="cfdocexamples" maxrows="10">


SELECT Emp_ID, FirstName, LastName, Salary FROM EMPLOYEE
</cfquery>

<cfdocument format="pdf">
<cfoutput>
<cfdocumentitem type="header">
Current Section Page Number:
#cfdocument.currentsectionpagenumber#
</cfdocumentitem>

<cfdocumentsection>
<h3 style="color:DodgerBlue; font-style:italic">
cfdocument scope example: currentsectionpagenumber
</h3>

<cftable query="qEmployee" colheaders="yes" htmltable="no"


border="no">
<cfcol header="ID" text="#Emp_ID#">
<cfcol header="First Name" text="#FirstName#">
<cfcol header="Last Name" text="#LastName#">
<cfcol header="Salary" text="#Salary#">
</cftable>
<cfdocumentitem type="pagebreak">
</cfdocumentitem>
<h3 style="color:Crimson; font-style:italic">
This is a new page
</h3>
</cfdocumentsection>

<cfdocumentsection>
<h3 style="color:Crimson; font-style:italic">
This is a new section.
</h3>
</cfdocumentsection>
</cfoutput>
</cfdocument>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cfdocument-scope-currentsectionpagenumb.html
Example 59

cfdocument tag: how to show header in printable document as


cfdocumentitem type header
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfdocument tag: how to show header in printable document as
cfdocumentitem type header</title>
</head>

<body>

<cfquery name="qCenters" datasource="cfdocexamples" maxrows="10">


SELECT Center_ID, Name FROM CENTERS
</cfquery>

<cfdocument format="pdf">
<cfoutput>
<cfdocumentitem type="header">
Page Header <br />Current Page Number:
#cfdocument.currentpagenumber#
</cfdocumentitem>

<cfdocumentsection>
<h4 style="color:Crimson; font-style:italic">
cfdocument example: display document header
</h4>
<cftable query="qCenters" colheaders="yes" htmltable="no"
border="no">
<cfcol header="Center ID" text="#Center_ID#">
<cfcol header="Center Name" text="#Name#">
</cftable>
<cfdocumentitem type="pagebreak">
</cfdocumentitem>
<h3 style="color:DimGray; font-style:italic">
This is another page
</h3>
</cfdocumentsection>
</cfoutput>
</cfdocument>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cfdocument-tag-how-to-show-header-in.html
Example 60

cfdocument tag: how to use pagebreak (page break) as


cfdocumentitem type in printable document
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfdocument tag: how to use pagebreak (page break) as
cfdocumentitem type in printable document</title>
</head>

<body>

<cfquery name="qParks" datasource="cfdocexamples" maxrows="10">


SELECT ParkName, City FROM PARKS
</cfquery>

<cfdocument format="pdf">
<cfoutput>
<cfdocumentitem type="header">
This isPage Header <br />
Total Page Count: #cfdocument.totalpagecount#
</cfdocumentitem>

<cfdocumentsection>
<h3 style="color:Crimson; font-style:italic">
cfdocument example: using page break
</h3>
<cftable query="qParks" colheaders="yes" htmltable="no"
border="no">
<cfcol header="Park Name" text="#ParkName#">
<cfcol header="City" text="#City#">
</cftable>
<cfdocumentitem type="pagebreak">
</cfdocumentitem>
<h3 style="color:DimGray; font-style:italic">
This is another page
</h3>
</cfdocumentsection>
</cfoutput>
</cfdocument>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cfdocument-tag-how-to-use-pagebreak.html
Example 61

cfdocument scope totalpagecount: how to show total page


count in printable document
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfdocument scope totalpagecount: how to show total page count in
printable document</title>
</head>

<body>

<cfquery name="qEmployee" datasource="cfdocexamples" maxrows="10">


SELECT Emp_ID, FirstName, LastName, Salary FROM EMPLOYEE
</cfquery>

<cfdocument format="pdf">
<cfoutput>
<cfdocumentitem type="header">
Total Page Count: #cfdocument.totalpagecount#
</cfdocumentitem>

<cfdocumentsection>

<h2 style="color:SeaGreen; font-style:italic">


cfdocument scope example: totalpagecount
</h2>

<cftable query="qEmployee" colheaders="yes" htmltable="no"


border="no">
<cfcol header="ID" text="#Emp_ID#">
<cfcol header="First Name" text="#FirstName#">
<cfcol header="Last Name" text="#LastName#">
<cfcol header="Salary" text="#Salary#">
</cftable>
<cfdocumentitem type="pagebreak">
</cfdocumentitem>
<h3 style="color:Crimson; font-style:italic">
This is a new page
</h3>
</cfdocumentsection>
</cfoutput>
</cfdocument>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cfdocument-scope-totalpagecount-how-to.html
Example 62

cfdocument scope totalsectionpagecount: how to show total


section page count in printable document
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfdocument scope totalsectionpagecount: how to show total section
page count in printable document</title>
</head>

<body>

<cfquery name="qEmployee" datasource="cfdocexamples" maxrows="10">


SELECT Emp_ID, FirstName, LastName, Salary FROM EMPLOYEE
</cfquery>

<cfdocument format="pdf">
<cfoutput>
<cfdocumentitem type="header">
Total Section Page Count: #cfdocument.totalsectionpagecount#
</cfdocumentitem>

<cfdocumentsection>
<h3 style="color:RosyBrown; font-style:italic">
cfdocument scope example: totalsectionpagecount
</h3>

<cftable query="qEmployee" colheaders="yes" htmltable="no"


border="no">
<cfcol header="ID" text="#Emp_ID#">
<cfcol header="First Name" text="#FirstName#">
<cfcol header="Last Name" text="#LastName#">
<cfcol header="Salary" text="#Salary#">
</cftable>
<cfdocumentitem type="pagebreak">
</cfdocumentitem>
<h3 style="color:Green; font-style:italic">
This is a new page
</h3>
</cfdocumentsection>

<cfdocumentsection>
<h3 style="color:SaddleBrown; font-style:italic">
This is a new section
</h3>
</cfdocumentsection>
</cfoutput>
</cfdocument>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cfdocument-scope-totalsectionpagecount.html
Example 63

cfdocument and cfhttp tag: how to display web pages in


printable document
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfdocument and cfhttp tag: how to display web pages in printable
document</title>
</head>

<body>
<cfhttp url="http://www.gmail.com/" resolveurl="yes">

<cfdocument format="pdf">
<cfoutput>
#cfhttp.FileContent#
</cfoutput>
</cfdocument>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cfdocument-and-cfhttp-tag-how-to.html
Example 64

cfdocument tag: how to show footer in printable document as


cfdocumentitem type footer
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfdocument tag: how to show footer in printable document as
cfdocumentitem type footer</title>
</head>

<body>

<cfquery name="qCenters" datasource="cfdocexamples" maxrows="11">


SELECT Center_ID, Name, City FROM CENTERS
</cfquery>

<cfdocument format="pdf">
<cfoutput>
<cfdocumentitem type="footer">
Page Footer <br />Current Page Number:
#cfdocument.currentpagenumber#
</cfdocumentitem>

<cfdocumentsection>
<h4 style="color:DarkCyan; font-style:italic">
cfdocument example: display document footer
</h4>
<cftable query="qCenters" colheaders="yes" htmltable="no"
border="no">
<cfcol header="Center ID" text="#Center_ID#">
<cfcol header="Center Name" text="#Name#">
<cfcol header="City" text="#City#">
</cftable>
<cfdocumentitem type="pagebreak">
</cfdocumentitem>
<h3 style="color:DimGray; font-style:italic">
This is a new page
</h3>
</cfdocumentsection>
</cfoutput>
</cfdocument>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cfdocument-tag-how-to-show-footer-in.html
Example 65

How to use encryption, permissions, userpassword,


ownerpassword property in cfdocument pdf document
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>How to use encryption, permissions, userpassword, ownerpassword
property in cfdocument pdf document</title>
</head>

<body>

<cfquery name="qCenters" datasource="cfdocexamples" maxrows="11">


SELECT Center_ID, Name, City FROM CENTERS
</cfquery>

<cfdocument
format="pdf"
encryption="128-bit"
permissions="allowprinting"
userpassword="jenny"
ownerpassword="jones"
>
<cfoutput>
<cfdocumentitem type="header">
Current Page Number: #cfdocument.currentpagenumber#
</cfdocumentitem>

<cfdocumentsection name="Center Details">


<h4 style="color:OrangeRed; font-style:italic">
Center Details
</h4>
<cftable query="qCenters" colheaders="yes" htmltable="no"
border="no">
<cfcol header="Center ID" text="#Center_ID#">
<cfcol header="Center Name" text="#Name#">
<cfcol header="City" text="#City#">
</cftable>
</cfdocumentsection>
</cfoutput>
</cfdocument>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/how-to-use-encryption-permissions.html
Example 66

cfdocument tag: how to use and show bookmark in pdf


document in coldfusion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfdocument tag: how to use and show bookmark in pdf document in
coldfusion</title>
</head>

<body>

<cfquery name="qCenters" datasource="cfdocexamples" maxrows="11">


SELECT Center_ID, Name, City FROM CENTERS
</cfquery>

<cfquery name="qParks" datasource="cfdocexamples" maxrows="11">


SELECT ParkName, City FROM Parks
</cfquery>

<cfdocument format="pdf" bookmark="true">


<cfoutput>
<cfdocumentitem type="header">
Current Page Number: #cfdocument.currentpagenumber#
</cfdocumentitem>

<cfdocumentsection name="Center Details">


<h4 style="color:DarkCyan; font-style:italic">
Center Details
</h4>
<cftable query="qCenters" colheaders="yes" htmltable="no"
border="no">
<cfcol header="Center ID" text="#Center_ID#">
<cfcol header="Center Name" text="#Name#">
<cfcol header="City" text="#City#">
</cftable>
</cfdocumentsection>

<cfdocumentsection name="Park Details">


<h4 style="color:DarkCyan; font-style:italic">
Park Details
</h4>
<cftable query="qParks" colheaders="yes" htmltable="no"
border="no">
<cfcol header="Park Name" text="#ParkName#">
<cfcol header="City" text="#City#">
</cftable>
</cfdocumentsection>
</cfoutput>
</cfdocument>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cfdocument-tag-how-to-use-and-show.html
Example 67

cfdump tag: how to use metainfo attribute in cfdump for query


output
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfdump tag: how to use metainfo attribute in cfdump for query
output</title>
</head>

<body>
<h2 style="color:OrangeRed; font-style:italic">cfdump tag example: how to
use metainfo attribute</h2>
<hr width="500" align="left" color="CadetBlue" />
<br />

<cfquery name="qParks" datasource="cfdocexamples" maxrows="3">


Select ParkName, City From Parks
</cfquery>

<cfdump var="#qParks#" label="Parks [without metainfo]" metainfo="no">


<br /><br />

<cfdump var="#qParks#" label="Parks [with metainfo]" metainfo="yes">

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cfdump-tag-how-to-use-metainfo.html
Example 68

cfdump tag: how to use hide attribute in cfdump for hide query
columns
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfdump tag: how to use hide attribute in cfdump for hide query
columns</title>
</head>

<body>
<h2 style="color:DarkMagenta; font-style:italic">cfdump tag example: how
to hide query columns</h2>
<hr width="500" align="left" color="CadetBlue" />
<br />

<cfquery name="qEmployee" datasource="cfdocexamples" maxrows="3">


Select Emp_ID, FirstName, LastName From Employees
</cfquery>

<cfdump var="#qEmployee#" label="Employees [Hide Emp_ID, FirstName]"


hide="Emp_ID, FirstName">
<br /><br />

<cfdump var="#qEmployee#" label="Employees [Show All Columns]">

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cfdump-tag-how-to-use-hide-attribute-in.html
Example 69

cfdump tag: how to use hide attribute in cfdump for hide


structure keys
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfdump tag: how to use hide attribute in cfdump for hide structure
keys</title>
</head>

<body>
<h2 style="color:Crimson; font-style:italic">cfdump tag example: how to
hide structure keys</h2>
<hr width="500" align="left" color="CadetBlue" />
<br />

<cfset Color=StructNew()>
<cfset Color.ID=1>
<cfset Color.Name="Bisque">
<cfset Color.Value="##FFE4C4">

<cfdump var="#Color#" label="Color [Hide ID, Value]" hide="ID,Value">


<br /><br />

<cfdump var="#Color#" label="Color [Show All Keys]">

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cfdump-tag-how-to-use-hide-attribute-
in_24.html
Example 70

cfdump tag: how to get output in a file or browser

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfdump tag: how to get output in a file or browser</title>
</head>

<body>
<h2 style="color:OrangeRed; font-style:italic">cfdump tag example: how to
get output in a file or browser</h2>
<hr width="575" align="left" color="CadetBlue" />
<br />

<cfquery name="qCenters" datasource="cfdocexamples" maxrows="3">


Select Center_ID, Name From Centers
</cfquery>

<cfdump var="#qCenters#" label="Centers [file output]"


output="c:\Centers.txt">
<br /><br />

<cfdump var="#qCenters#" label="Centers [browser output]"


output="browser">

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cfdump-tag-how-to-get-output-in-file-or.html
Example 71

cfdump tag: how to use top attribute for show specific number
of rows in query
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfdump tag: how to use top attribute for show specific number of
rows in query</title>
</head>

<body>
<h2 style="color:PaleVioletRed; font-style:italic">cfdump tag example:
show specific number of rows in query</h2>
<hr width="600" align="left" color="CadetBlue" />
<br />

<cfquery name="qDepartments" datasource="cfdocexamples">


Select Dept_ID, Dept_Name From Departments
</cfquery>

<cfdump var="#qDepartments#" label="Departments [show 2 rows]" top="2">


<br /><br />

<cfdump var="#qDepartments#" label="Departments [Show All rows]">

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cfdump-tag-how-to-use-top-attribute-for.html
Example 72

cfdump tag: how to show specific columns in query output

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfdump tag: how to show specific columns in query output</title>
</head>

<body>
<h2 style="color:Green; font-style:italic">cfdump tag example: show
specific columns in query output</h2>
<hr width="575" align="left" color="CadetBlue" />
<br />

<cfquery name="qDepartment" datasource="cfdocexamples" maxrows="3">


Select Dept_ID, Dept_Name, location From Departmt
</cfquery>

<cfdump var="#qDepartment#" label="Department [Show Dept_ID, Dept_Name]"


show="Dept_ID, Dept_Name">
<br /><br />

<cfdump var="#qDepartment#" label="Department [Show All Columns]">

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cfdump-tag-how-to-show-specific-columns.html
Example 73

cfdump tag: how to show specific keys in structure output

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfdump tag: how to show specific keys in structure output</title>
</head>

<body>
<h2 style="color:Olive; font-style:italic">cfdump tag example: show
specific keys in structure output</h2>
<hr width="600" align="left" color="CadetBlue" />
<br />

<cfset Color=StructNew()>
<cfset Color.ID=3>
<cfset Color.Name="NavajoWhite">
<cfset Color.Value="##FFDEAD">

<cfdump var="#Color#" label="Color [Show ID, Name]" show="ID,Name">


<br /><br />

<cfdump var="#Color#" label="Color [Show All Keys]">

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cfdump-tag-how-to-show-specific-keys-in.html
Example 74

cfdump tag: how to show number of nested levels in structure


by top attribute
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfdump tag: how to show number of nested levels in structure by
top attribute</title>
</head>

<body>
<h2 style="color:Red; font-style:italic">cfdump tag example: show number
of nested levels in structure</h2>
<hr width="625" align="left" color="CadetBlue" />
<br />

<cfset Employee=StructNew()>
<cfset Employee.ID=1>
<cfset Employee.Name.FirstName="Jenny">
<cfset Employee.Name.LastName="Jones">
<cfset Employee.City="Rome">

<cfdump var="#Employee#" label="Employee [show 1 nested levels]" top="1">


<br /><br />

<cfdump var="#Employee#" label="Employee [show all nested levels]">

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cfdump-tag-how-to-show-number-of-nested.html
Example 75

cfdump var expression - how to use expression in cfdump var


attribute
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfdump var expression - how to use expression in cfdump var
attribute</title>
</head>

<body>
<h2 style="color:DarkBlue; font-style:italic">coldfusion cfdump var
expression: how to use</h2>
<hr width="450" align="left" color="LightBlue" />
<br />

<cfset Number1=5>
<cfset Number2=10>

<table border="0" cellpadding="2" cellspacing="2" bgcolor="DeepPink"


width="250">
<tr style="background-color:HotPink; color:Snow; font-size:large;">
<td>cfdump var</td>
<td>Output</td>
</tr>
<tr style="background-color:OrangeRed; color:Snow;">
<td>var="#Number1#"</td>
<td><cfdump var="#Number1#"></td>
</tr>
<tr style="background-color:OrangeRed; color:Snow;">
<td>var="#Number2#"</td>
<td><cfdump var="#Number2#"></td>
</tr>
<tr style="background-color:OrangeRed; color:Snow;">
<td>var=#Number1*Number2#</td>
<td><cfdump var=#Number1*Number2#></td>
</tr>
<tr style="background-color:OrangeRed; color:Snow;">
<td>var="#Number1+Number2#"</td>
<td><cfdump var="#Number1+Number2#"></td>
</tr>
<tr style="background-color:OrangeRed; color:Snow;">
<td>var="#(100/5)*2#"</td>
<td><cfdump var="#(100/5)*2#"></td>
</tr>
</table>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/12/cfdump-var-expression-how-to-use.html
Example 76

cffile tag: how to copy file programmatically

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion cffile tag example: how to copy file
programmatically</title>
</head>

<body>
<h2 style="color:DodgerBlue">ColdFusion cffile tag example: Copy</h2>

<cfset SourceFile="C:\Test.txt">
<cfset Destination="C:\TestFolder\Test.txt">
<cfoutput>
<cfif FileExists(SourceFile)>
Source File Exists: #SourceFile#
<br />
Destination: #Destination#
<cffile action="copy" source="#SourceFile#"
destination="#Destination#">
<br />
file copy to desination successfully!
<cfelse>
Source File not Exists: #SourceFile#
</cfif>
</cfoutput>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/03/cffile-tag-how-to-copy-file.html
Example 77

cffile tag: how to delete file programmatically

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion cffile tag example: how to delete file
programmatically</title>
</head>

<body>
<h2 style="color:DodgerBlue">ColdFusion cffile tag example: Delete</h2>

<cfset SourceFile="C:\Test1.txt">
<cfoutput>
<cfif FileExists(SourceFile)>
File Exists: #SourceFile#
<cffile action="delete" file="#SourceFile#">
<br />
file deleted successfully!
<cfelse>
File not Exists: #SourceFile#
</cfif>
</cfoutput>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/03/cffile-tag-how-to-delete-file.html
Example 78

cffile tag: how to move file programmatically

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion cffile tag example: how to move file
programmatically</title>
</head>

<body>
<h2 style="color:DodgerBlue">ColdFusion cffile tag example: Move</h2>

<cfset SourceFile="C:\Test2.txt">
<cfset Destination="C:\TestFolder\Test2.txt">
<cfoutput>
<cfif FileExists(SourceFile)>
Source File Exists: #SourceFile#
<br />
Destination: #Destination#
<cffile action="move" source="#SourceFile#"
destination="#Destination#">
<br />
file moved to desination successfully!
<cfelse>
Source File not Exists: #SourceFile#
</cfif>
</cfoutput>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/03/cffile-tag-how-to-move-file.html
Example 79

cffile tag: how to read file programmatically

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion cffile tag example: how to read file
programmatically</title>
</head>

<body>
<h2 style="color:DodgerBlue">ColdFusion cffile tag example: Read</h2>

<cfset SourceFile="C:\Test3.txt">
<cfoutput>
<cfif FileExists(SourceFile)>
File Exists: #SourceFile#
<cffile action="read" file="#SourceFile#" variable="FileContent">
<br /><br />
File read successfully!
<br />
File Content : <b>#FileContent#</b>
<cfelse>
File not Exists: #SourceFile#
</cfif>
</cfoutput>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/03/cffile-tag-how-to-read-file.html
Example 80

cffile tag: how to append text to a text file on the server

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion cffile tag example: how to append text to a text file
on the server</title>
</head>

<body>
<h2 style="color:DodgerBlue">ColdFusion cffile tag example: Append</h2>

<cfset MyFile="C:\Test.txt">

<cfoutput>
<cfif FileExists(MyFile)>
File Exists: #MyFile#
<cffile action="append" file="#MyFile#" output="This is a test
line.">
<br />
Text append in this file successfully!
<cfelse>
File not Exists: #MyFile#
</cfif>
</cfoutput>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/03/cffile-tag-how-to-append-text-to-text.html
Example 81

cffile tag: how to read a binary file programmatically

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion cffile tag example: how to read a binary file
programmatically</title>
</head>

<body>
<h2 style="color:DodgerBlue">ColdFusion cffile tag example:
readBinary</h2>

<cfset SourceFile="C:\logo.gif">
<cfoutput>
<cfif FileExists(SourceFile)>
File Exists: #SourceFile#
<cffile action="readbinary" file="#SourceFile#"
variable="FileContent">
<br /><br />
File read successfully!
<br />
<cfdump var="#FileContent#">
<cfelse>
File not Exists: #SourceFile#
</cfif>
</cfoutput>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/03/cffile-tag-how-to-read-binary-file.html
Example 82

cffile tag: how to rename file programmatically

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion cffile tag example: how to rename file
programmatically</title>
</head>

<body>
<h2 style="color:DodgerBlue">ColdFusion cffile tag example: Rename</h2>

<cfset SourceFile="C:\Test4.txt">
<cfset Destination="C:\Test5.txt">
<cfoutput>
<cfif FileExists(SourceFile)>
Source File Exists: #SourceFile#
<br />
Destination: #Destination#
<cffile action="rename" source="#SourceFile#"
destination="#Destination#">
<br />
file renamed successfully!
<cfelse>
Source File not Exists: #SourceFile#
</cfif>
</cfoutput>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/03/cffile-tag-how-to-rename-file.html
Example 83

cffile tag: how to write text to a text file or create new one

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion cffile tag example: how to write text to a text file or
create new one</title>
</head>

<body>
<h2 style="color:DodgerBlue">ColdFusion cffile tag example: Write,
Create</h2>

<cfset MyFile="C:\Test6.txt">

<cfoutput>
File: #MyFile#
<cffile action="write" file="#MyFile#" output="cffile tag example
action write.">
<br />
Text write in file successfully!
</cfoutput>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/03/cffile-tag-how-to-write-text-to-text.html
Example 84

cffile tag: how to upload file

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion cffile tag example: how to upload file</title>
</head>

<body>
<h2 style="color:DodgerBlue">ColdFusion cffile tag example: Upload</h2>

<cfset UploadFolder="C:\Upload">
<cfif IsDefined("Form.UploadFile") AND Form.UploadFile NEQ "">
<cffile
action="upload"
filefield="UploadFile"
destination="#UploadFolder#"
nameconflict="overwrite"
>
File uploaded successfully!
<br />
Uploaded file: <cfoutput>#cffile.ClientFile#</cfoutput>
<cfelse>
Select a file first!
</cfif>

<form name="UploadForm" method="post" enctype="multipart/form-data"


action="">
<input type="file" name="UploadFile">
<input type="submit" name="submit" value="Upload"/>
</form>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/03/cffile-tag-how-to-upload-file.html
Example 85

cffile tag: how to upload only image file in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cffile tag: how to upload only image file in coldfusion</title>
</head>

<body>
<h2 style="color:DodgerBlue; font-style:italic">cffile example: Upload
Image</h2>
<hr width="350" align="left" color="PaleVioletRed" />

<cfset UploadFolder="C:\UploadImage">

<h3 style="color:DeepPink; font-style:italic;">


<cfoutput>
<cfif DirectoryExists(UploadFolder)>
<cfif IsDefined("Form.UploadFile") AND Form.UploadFile NEQ "">
<cftry>
<cffile
action="upload"
filefield="UploadFile"
destination="#UploadFolder#"
nameconflict="overwrite"
accept="image/*"
>
File uploaded successfully!
<br />
Uploaded file: #cffile.ClientFile#
<cfcatch type="any">
Error: #cfcatch.Message#
</cfcatch>
</cftry>
<cfelse>
Select a file first!
</cfif>
<cfelse>
Upload Directory not exists
</cfif>
</cfoutput>
</h3>

<form name="UploadForm" method="post" enctype="multipart/form-data"


action="">
<input type="file" name="UploadFile">
<input type="submit" name="submit" value="Upload"/>
</form>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/04/cffile-tag-how-to-upload-only-image.html
Example 86

cfform tag: how to use flash format form

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion cfform tag example: how to use flash format
form</title>
</head>

<body>
<h2 style="color:DodgerBlue">cfform example: Flash Format Form</h2>
<cfif IsDefined("Form.Submit")>
<cfoutput>
Hi <b>#Form.UserName#!</b> You came from <b>#Form.City#</b>
</cfoutput>
</cfif>
<br /><br />

<cfform
name="FlashForm"
method="post"
action=""
format="flash"
width="350"
height="250"
skin="halogreen"
>
<cfformgroup type="panel" label="User Details">
<cfinput type="text" name="UserName" label="User Name"
required="yes" message="Name Required">
<cfinput type="text" name="City" label="City" required="yes"
message="City Required">
<cfinput type="submit" name="Submit" value="Submit">
</cfformgroup>
</cfform>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/03/cfform-tag-how-to-use-flash-format-form.html
Example 87

cfform tag: how to use flash format form with cfformgroup

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion cfform tag example: how to use flash format form with
cfformgroup</title>
</head>

<body>
<h2 style="color:DodgerBlue">cfform example: Flash Format Form and
cfformgroup</h2>
<cfif IsDefined("Form.Submit")>
<cfoutput>
Hi <b>#Form.UserName#!</b> You came from <b>#Form.City#</b>
<br />
Your Group Name: <b>#Form.UserGroup#</b> and Member ID:
<b>#Form.memberID#</b>
</cfoutput>
</cfif>
<br /><br />

<cfform
name="FlashFormatForm"
method="post"
action=""
format="flash"
width="500"
height="350"
skin="haloorange"
>
<cfformgroup type="panel" label="Member Details">
<cfformgroup type="hdividedbox">
<cfformgroup type="vbox">
<cfinput type="text" name="UserName" label="User Name"
required="yes" message="Name Required">
<cfinput type="text" name="City" label="City"
required="yes" message="City Required">
</cfformgroup>
<cfformgroup type="vbox">
<cfinput type="text" name="UserGroup" label="User Group"
required="yes" message="Group Name Required">
<cfinput type="text" name="MemberID" label="Member ID"
required="yes" message="Member ID Required">
</cfformgroup>
</cfformgroup>
<cfinput type="submit" name="Submit" value="Submit">
</cfformgroup>
</cfform>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/03/cfform-tag-how-to-use-flash-format-
form_03.html
Example 88

cffrom preservedata property: How to preserve data in


coldfusion form
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cffrom preservedata property: How to preserve data in coldfusion
form</title>
</head>

<body>
<h2 style="color:DodgerBlue; font-style:italic">cfform example:
preservedata property</h2>
<hr width="350" align="left" color="PaleVioletRed" />
<br />

<cfform name="testForm" method="post" preservedata="yes">


<b>Name</b>
<cfinput name="Name" type="text">
<br />
<b>Address</b>
<cfinput name="Address" type="text">
<br />
<cfinput name="Submit" type="submit" value="Submit Data">
</cfform>

<h4 style="color:#F30;">
<cfif IsDefined("Form.Submit")>
<cfoutput>
Your name: #Form.Name#
<br />
Address: #Form.Address#
</cfoutput>
</cfif>
</h4>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/04/cffrom-preservedata-property-how-to.html
Example 89

cfformgroup tag: how to use accordion and page in flash format


form
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion cfformgroup tag example: how to use accordion and page
in flash format form</title>
</head>

<body>
<h2 style="color:DodgerBlue">cfformgroup example: Flash Format Form and
Accordion</h2>
<cfif IsDefined("Form.Submit")>
<cfoutput>
Country: <b>#Form.Country#</b>
<br />
City: <b>#Form.City#</b>
</cfoutput>
</cfif>
<br /><br />

<cfform
name="FlashFormAccordion"
method="post"
action=""
format="flash"
width="500"
height="250"
skin="halosilver"
>
<cfformgroup type="panel" label="User Address">
<cfformgroup type="accordion">
<cfformgroup type="page" label="Country">
<cfinput type="text" name="Country" label="Country"
required="yes" message="Country Required">
</cfformgroup>
<cfformgroup type="page" label="City">
<cfinput type="text" name="City" label="City"
required="yes" message="City Required">
</cfformgroup>
</cfformgroup>
<cfinput type="submit" name="Submit" value="Submit Details">
</cfformgroup>
</cfform>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/03/cfformgroup-tag-how-to-use-accordion.html
Example 90

cfformgroup tag: how to use panel in flash format form

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion cfformgroup tag example: how to use panel in flash
format form</title>
</head>

<body>
<h2 style="color:DodgerBlue">cfformgroup example: Flash Format Form and
Panel</h2>
<cfif IsDefined("Form.Submit")>
<cfoutput>
Name: <b>#Form.Name#!</b>
<br />
Address: <b>#Address#</b>
</cfoutput>
</cfif>
<br /><br />

<cfform
name="FlashPanelForm"
method="post"
action=""
format="flash"
width="500"
height="350"
skin="haloblue"
>
<cfformgroup type="panel" label="Guest Details">
<cfinput type="text" name="Name" label="Name" required="yes"
message="Name Required">
<cfinput type="text" name="Address" label="Address"
required="yes" message="Address Required">
<cfinput type="submit" name="Submit" value="Submit Details">
</cfformgroup>
</cfform>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/03/cfformgroup-tag-how-to-use-panel-in.html
Example 91

cfformgroup tag: how to use horizontal divided box


(hdividedbox) in flash format form
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion cfformgroup tag example: how to use horizontal divided
box (hdividedbox) in flash format form</title>
</head>

<body>
<h2 style="color:DodgerBlue">cfformgroup example: Flash Format Form and
hdividedbox</h2>
<cfif IsDefined("Form.Submit")>
<cfoutput>
City Name: <b>#Form.City#!</b>
<br />
Zip: <b>#Form.Zip#</b>
</cfoutput>
</cfif>
<br /><br />

<cfform
name="FlashFormDevider"
method="post"
action=""
format="flash"
width="500"
height="250"
skin="halogreen"
>
<cfformgroup type="panel" label="City Details">
<cfformgroup type="hdividedbox">
<cfformgroup type="hbox">
<cfinput type="text" name="City" label="City"
required="yes" message="City Required">
</cfformgroup>
<cfformgroup type="hbox">
<cfinput type="text" name="Zip" label="Zip"
required="yes" message="Zip Required">
</cfformgroup>
</cfformgroup>
<cfinput type="submit" name="Submit" value="Submit City">
</cfformgroup>
</cfform>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/03/cfformgroup-tag-how-to-use-horizontal.html
Example 92

cfformgroup tag: how to use Tab Navigator (tabnavigator) in


flash format form
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion cfformgroup tag example: how to use Tab Navigator
(tabnavigator) in flash format form</title>
</head>

<body>
<h2 style="color:DodgerBlue">cfformgroup example: Flash Format Form and
tabnavigator</h2>
<cfif IsDefined("Form.Submit")>
<cfoutput>
Country: <b>#Form.Country#</b>
<br />
City: <b>#Form.City#</b>
</cfoutput>
</cfif>
<br /><br />

<cfform
name="FlashFormTabNavigator"
method="post"
action=""
format="flash"
width="500"
height="250"
skin="halosilver"
>
<cfformgroup type="panel" label="Location Details">
<cfformgroup type="tabnavigator" label="User Address">
<cfformgroup type="page" label="Country">
<cfinput type="text" name="Country" label="Country"
required="yes" message="Country Required">
</cfformgroup>
<cfformgroup type="page" label="City">
<cfinput type="text" name="City" label="City"
required="yes" message="City Required">
</cfformgroup>
</cfformgroup>
<cfinput type="submit" name="Submit" value="Submit Location">
</cfformgroup>
</cfform>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/03/cfformgroup-tag-how-to-use-tab.html
Example 93

cfformgroup tag: how to use vertical divided box (vdividedbox)


in flash format form
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion cfformgroup tag example: how to use vertical divided
box (vdividedbox) in flash format form</title>
</head>

<body>
<h2 style="color:DodgerBlue">cfformgroup example: Flash Format Form and
vdividedbox</h2>
<cfif IsDefined("Form.Submit")>
<cfoutput>
Guest Name: <b>#Form.Name#!</b>
<br />
Address: <b>#Form.Address#</b>
</cfoutput>
</cfif>
<br /><br />

<cfform
name="FlashFormExample"
method="post"
action=""
format="flash"
width="500"
height="250"
skin="haloblue"
>
<cfformgroup type="panel" label="Guest Details">
<cfformgroup type="vdividedbox">
<cfformgroup type="hbox">
<cfinput type="text" name="Name" label="Name"
required="yes" message="Name Required">
</cfformgroup>
<cfformgroup type="hbox">
<cfinput type="text" name="Address" label="Address"
required="yes" message="Address Required">
</cfformgroup>
</cfformgroup>
<cfinput type="submit" name="Submit" value="Submit Details">
</cfformgroup>
</cfform>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/03/cfformgroup-tag-how-to-use-vertical.html
Example 94

cffunction tag example: how to create a function in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cffunction tag example: how to create a function in
coldfusion</title>
</head>

<body>
<h2 style="color:Crimson">cffunction Tag Example</h2>

<cfset TotalRecord=GetTotalRecord("cfbookclub", "Books", "BookID")>


<cfoutput>
<b>Total Record [DataSource cfbookclub; Table BOOKS]: </b> #TotalRecord#
</cfoutput>
<cffunction name="GetTotalRecord" access="remote" returntype="numeric"
description="Return table number of records">
<cfargument name="DataSource" type="string" required="yes">
<cfargument name="TableName" type="string" required="yes">
<cfargument name="FieldName" type="string" required="yes">
<cfquery name="qTableData" datasource="#arguments.DataSource#">
SELECT COUNT(#arguments.FieldName#) AS TotalRecord FROM
#arguments.TableName#
</cfquery>
<cfreturn qTableData.TotalRecord>
</cffunction>
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/cffunction-tag-example-how-to-function.html
Example 95

cfgrid tag: how to display data in a html format grid

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfgrid tag example: how to display data in a html format
grid</title>
</head>

<body>
<h2 style="color:DodgerBlue">ColdFusion cfgrid example: HTML Format</h2>

<cfquery name="qEmployee" datasource="cfdocexamples">


SELECT Emp_ID,FirstName,LastName,Email FROM Employees
</cfquery>

<cfform method="post" name="GridExampleForm">


<cfgrid
name="Employee"
query="qEmployee"
format="html"
width="400"
height="350"
>
</cfgrid>
</cfform>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/03/cfgrid-tag-how-to-display-data-in-html.html
Example 96

cfimage action captcha: how to create captcha in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfimage action captcha: how to create captcha in
coldfusion</title>
</head>

<body>
<h2 style="color:Crimson; font-style:italic">cfimage tag example: how to
create captcha</h2>
<hr width="500" align="left" color="OrangeRed" />
<br />

<table border="1" cellpadding="5" cellspacing="0"


bordercolor="OrangeRed">
<tr bgcolor="OrangeRed" style="color:Snow; font-size:large"
align="center">
<td>
Sample captcha: Captcha
</td>
<td>
Sample captcha: ColdFusion
</td>
</tr>
<tr height="100" valign="top" style="color:RosyBrown; font-
weight:bold">
<td >
<cfimage action="captcha" difficulty="medium" text="Captcha"/>
</td>
<td>
<cfimage action="captcha" difficulty="low" text="ColdFusion"/>
</td>
</tr>
</table>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/06/cfimage-action-captcha-how-to-create.html
Example 97

cfimage: how to generate random captcha text in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfimage: how to generate random captcha text in coldfusion</title>
</head>

<body>
<h2 style="color:OrangeRed; font-style:italic">cfimage tag example: how
to generate random captcha text</h2>
<hr width="600" align="left" color="OrangeRed" />
<br />

<cfset MyRandomNumber=RandRange(1000,10000)>
<cfset MyRandomText1="CF#MyRandomNumber#">

<cfset MyRandomNumber=RandRange(1000,10000)>
<cfset MyRandomText2="CF#MyRandomNumber#">

<cfset MyRandomNumber=RandRange(1000,10000)>
<cfset MyRandomText3="CF#MyRandomNumber#">

<table border="1" cellpadding="5" cellspacing="0" bordercolor="SeaGreen">


<tr bgcolor="DarkSeaGreen" style="color:Snow; font-size:large"
align="center">
<td>
captcha random text
</td>
<td>
captcha random text
</td>
<td>
captcha random text
</td>
</tr>
<tr height="75" valign="top" style="color:RosyBrown; font-
weight:bold">
<td >
<cfimage
action="captcha"
difficulty="medium"
text="#MyRandomText1#"
/>
</td>
<td>
<cfimage
action="captcha"
difficulty="medium"
text="#MyRandomText2#"
/>
</td>
<td>
<cfimage
action="captcha"
difficulty="medium"
text="#MyRandomText3#"
/>
</td>
</tr>
</table>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/06/cfimage-how-to-generate-random-captcha.html
Example 98

cfimage action captcha: how to create and use captcha in


coldfusion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfimage action captcha: how to create and use captcha in
coldfusion</title>
</head>

<body>
<h2 style="color:Orangered; font-style:italic">cfimage tag example: how
to create and use captcha</h2>
<hr width="550" align="left" color="Orangered" />
<br />

<cfif IsDefined("Form.Submit") and Form.ValidateCaptcha EQ "Captcha">


<h3 style="color:SeaGreen; font-style:italic">
<cfoutput>#Form.Email# successfully subscribe our
newsletter.</cfoutput>
</h3>
</cfif>

<table border="1" cellpadding="5" cellspacing="0" bordercolor="Orange">


<tr bgcolor="OrangeRed" style="color:Snow; font-size:large"
align="center">
<td colspan="2">
Subscribe our newsletter
</td>
</tr>
<cfform name="NewsletterForm" action="" method="post">
<tr valign="top" style="color:RosyBrown; font-weight:bold">
<td>
Input Captcha Text
</td>
<td>
<cfimage
action="captcha"
difficulty="medium"
text="Captcha"
/>
<br />
<cfinput
name="ValidateCaptcha"
type="text"
required="yes"
message="Input Captcha Text"
style="background-color:Wheat; color:RosyBrown;
height:25px; font-size:large; font-style:italic; font:'Comic Sans MS',
cursive"
/>
</td>
</tr>
<tr valign="top" style="color:RosyBrown; font-weight:bold">
<td>
Email
</td>
<td>
<cfinput
name="Email"
type="text"
validate="email"
required="yes"
message="Email required."
style="background-color:Wheat; color:RosyBrown;
height:25px; font-size:large; font-style:italic; font:'Comic Sans MS',
cursive"
/>
</td>
</tr>
<tr valign="top" style="color:RosyBrown; font-weight:bold">
<td align="right" colspan="2">
<cfinput
type="submit"
name="Submit"
value="Subscribe"
style="height:45px; width:150px; font-size:large; font-
style:italic; font-weight:bold; color:OrangeRed;"
>
</td>
</tr>
</cfform>
</table>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/06/cfimage-action-captcha-how-to-create_18.html
Example 99

cfinput type datefield: how to use input type datefield in


coldfusion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfinput type datefield: how to use input type datefield in
coldfusion</title>
</head>

<body>
<h2 style="color:SaddleBrown; font-style:italic">cfinput type datefield
example: how to use</h2>
<hr width="425" align="left" color="CadetBlue" />
<br />

<cfif IsDefined("Form.SubmitDate")>
<cfoutput>
<h3 style="color:OrangeRed;">
Your arrival date is: : #DateFormat(Form.DateChooser)#
</h3>
</cfoutput>
</cfif>

<cfform name="InputTypedateFieldTest" method="post" format="html">


<table border="1" cellpadding="5" cellspacing="0" bordercolor="Orange">
<tr>
<td colspan="2" bgcolor="DeepPink" style="color:Snow; font-
size:large" align="center">
Date Submit Form
</td>
</tr>
<tr valign="top">
<td style="color:RosyBrown; font-weight:bold">
Arival Date?
</td>
<td height="250">
<cfinput
name="DateChooser"
type="datefield"
validate="date"
>
</td>
</tr>
<tr>
<td colspan="2" align="right">
<cfinput name="SubmitDate" type="submit" value="Submit">
</td>
</tr>
</table>
</cfform>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/06/cfinput-type-datefield-how-to-use-input.html
Example 100

cfinput type text: how to create and use autosuggest in input


type text
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfinput type text: how to create and use autosuggest in input type
text</title>
</head>

<body>
<h2 style="color:SaddleBrown; font-style:italic">cfinput type text
example: how to use autosuggest</h2>
<hr width="500" align="left" color="SaddleBrown" />
<br />

<cfif IsDefined("Form.SubmitCountry")>
<cfoutput>
<h3 style="color:OrangeRed;">
Your Country is: : #Form.Country#
</h3>
</cfoutput>
</cfif>

<cfform name="InputTypeTextValidateTest" method="post" format="html">


<table border="1" cellpadding="5" cellspacing="0" bordercolor="Orange">
<tr>
<td colspan="2" bgcolor="DeepPink" style="color:Snow; font-
size:large" align="center">
Country Submit Form
</td>
</tr>
<tr height="100" valign="top">
<td style="color:RosyBrown; font-weight:bold">
Country Name
</td>
<td>
<cfinput
name="Country"
type="text"
style="background-color:Wheat; color:RosyBrown;
width:250px; height:25px; font-size:large; font-style:italic; font:'Comic
Sans MS', cursive"
autosuggest="USA, UK, India, France, Ireland,
Thailand"
>
</td>
</tr>
<tr>
<td colspan="2" align="right">
<cfinput name="SubmitCountry" type="submit" value="Submit">
</td>
</tr>
</table>
</cfform>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/06/cfinput-type-text-how-to-create-and-use.html
Example 101

cfinput type text: how to use range for integer validation in


coldfusion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfinput type text: how to use range for integer validation in
coldfusion</title>
</head>

<body>
<h2 style="color:Firebrick; font-style:italic">cfinput type text example:
how to use range</h2>
<hr width="450" align="left" color="Firebrick" />
<br />

<cfif IsDefined("Form.SubmitAge")>
<cfoutput>
<h3 style="color:HotPink;">
Your age is: #Form.Age#
</h3>
</cfoutput>
</cfif>

<cfform name="InputTypeTextRangeTest" method="post" format="html">


<table border="1" cellpadding="5" cellspacing="0"
bordercolor="Firebrick">
<tr>
<td colspan="2" bgcolor="Firebrick" style="color:Snow; font-
size:large" align="center">
Age Submit Form
</td>
</tr>
<tr>
<td style="color:Firebrick; font-weight:bold">
Your Age
</td>
<td>
<cfinput
name="Age"
type="text"
style="background-color:Cornsilk; color:Firebrick;
width:250px; height:25px; font-size:large; font-style:italic; font:'Comic
Sans MS', cursive"
required="yes"
message="Input age between 18 to 120."
range="18,120"
validate="integer"
>
</td>
</tr>
<tr>
<td colspan="2" align="right">
<cfinput
name="SubmitAge"
type="submit"
value="Submit Age"
style="height:45px; width:150px; font-size:large;
font-style:italic; font-weight:bold; color:Firebrick;"
>
</td>
</tr>
</table>
</cfform>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/06/cfinput-type-text-how-to-use-range-for.html
Example 102

cfinput: how to use validateAt onserver in input type text in


coldfusion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfinput: how to use validateAt onserver in input type text in
coldfusion</title>
</head>

<body>
<h2 style="color:SaddleBrown; font-style:italic">cfinput example: how to
use validateAt onserver</h2>
<hr width="475" align="left" color="RosyBrown" />
<br />

<cfif IsDefined("Form.SubmitAge")>
<cfoutput>
<h3 style="color:OrangeRed;">
Your age is: #Form.Age#
</h3>
</cfoutput>
</cfif>

<cfform name="InputTypeTextValidateAtTest" method="post" format="html">


<table border="1" cellpadding="5" cellspacing="0" bordercolor="Orange">
<tr>
<td colspan="2" bgcolor="DeepPink" style="color:Snow; font-
size:large" align="center">
Age Submit Form
</td>
</tr>
<tr>
<td style="color:RosyBrown; font-weight:bold">
Your Age
</td>
<td>
<cfinput
name="Age"
type="text"
style="background-color:Wheat; color:RosyBrown;
width:250px; height:25px; font-size:large; font-style:italic; font:'Comic
Sans MS', cursive"
required="yes"
validate="integer"
message="Input valid age."
validateat="onserver"
>
</td>
</tr>
<tr>
<td colspan="2" align="right">
<cfinput
name="SubmitAge"
type="submit"
value="Submit"
style="height:45px; width:150px; font-size:large;
font-style:italic; font-weight:bold; color:OrangeRed;"
>
</td>
</tr>
</table>
</cfform>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/06/cfinput-how-to-use-validateat-onserver.html
Example 103

cfloop tag example: how to loop over an array in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfloop tag example: how to loop over an array in
coldfusion</title>
</head>

<body>
<h2 style="color:Crimson">cfloop Tag Example: Array</h2>

<cfset ColorArray=ArrayNew(1)>
<cfset ColorArray[1]="Red">
<cfset ColorArray[2]="Green">
<cfset ColorArray[3]="Yellow">
<cfset ColorArray[4]="Blue">

<cfdump var="#ColorArray#" label="ColorArray">


<br />

Loop Start[ColorArray]...<br />


<cfloop array="#ColorArray#" Index="Color">
<cfoutput>
<b>Current Color:</b> #Color#<br />
</cfoutput>
</cfloop>
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/cfloop-tag-example-how-to-loop-over.html
Example 104

cfloop tag example: how to use conditional loop in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfloop tag example: how to use conditional loop in
coldfusion</title>
</head>

<body>
<h2 style="color:Crimson">cfloop Tag Example: conditional</h2>
<cfset LoopEndPosition=5>
<cfoutput>
<b>Loop End Position:</b> #LoopEndPosition#
</cfoutput>
<br /><br />

<cfset Counter=0>
Loop Start...<br />
<cfloop condition="LoopEndPosition GT Counter">
<cfset Counter=Counter+1>
<cfoutput>
<b>Current Position:</b> #Counter#<br />
</cfoutput>
</cfloop>
Loop End...

</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/cfloop-tag-example-how-to-use.html
Example 105

cfloop tag example: how to loop over a date range in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfloop tag example: how to loop over a date range in
coldfusion</title>
</head>

<body>
<h2 style="color:Crimson">cfloop Tag Example: date range</h2>

<cfset LoopStartDate="5-Dec-2008">
<cfset LoopEndDate="12-Dec-2008">

<cfoutput>
<b>LoopStartDate:</b> #LoopStartDate#<br />
<b>LoopEndDate:</b> #LoopEndDate#<br />
</cfoutput>
<br /><br />

Loop start ...<br />

<cfloop from="#LoopStartDate#" to="#LoopEndDate#" index="i">


<cfoutput>
<b>Current Position:</b> #DateFormat(i)#<br />
</cfoutput>
</cfloop>

<br /><br />


Loop start[step 2 days] ...<br />
<cfloop from="#LoopStartDate#" to="#LoopEndDate#" index="i"
step="#CreateTimeSpan(2,0,0,0)#">
<cfoutput>
<b>Current Position:</b> #DateFormat(i)#<br />
</cfoutput>
</cfloop>
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/cfloop-tag-example-how-to-loop-over_31.html
Example 106

cfloop tag example: how to use index loop in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfloop tag example: how to use index loop in coldfusion</title>
</head>

<body>
<h2 style="color:Crimson">cfloop Tag Example: index</h2>

<cfoutput>
<b>Loop start[1 to 10]....</b><br />
<cfloop from="1" to="10" index="Counter">
Current position: #Counter#<br />
</cfloop>
<b>Loop End....</b><br />

<br /><br />

<b>Loop start[1 to 10; step 2]....</b><br />


<cfloop from="1" to="10" step="2" index="Counter">
Current position: #Counter#<br />
</cfloop>
<b>Loop End....</b><br />

</cfoutput>
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/cfloop-tag-example-how-to-use-index.html
Example 107

cfloop tag example: how to loop over a list in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfloop tag example: how to loop over a list in coldfusion</title>
</head>

<body>
<h2 style="color:Crimson">cfloop Tag Example: List</h2>

<cfloop list="Jenny,Jones,John,Ben,Raymond,Kak" index="ListElement"


delimiters=",">
<cfoutput>
<b>Current List Element:</b> #ListElement#<br />
</cfoutput>
</cfloop>

<br /><br />


<cfset CityList="Rome;London;NewYork">
<cfoutput>
<b>CityList:</b> #CityList#<br />
</cfoutput>

<cfloop list="#CityList#" index="ListElement" delimiters=";">


<cfoutput>
<b>Current List Element:</b> #ListElement#<br />
</cfoutput>
</cfloop>

</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/cfloop-tag-example-how-to-loop-
over_9969.html
Example 108

cfloop tag example: how to loop over a query in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfloop tag example: how to loop over a query in coldfusion</title>
</head>

<body>
<h2 style="color:Crimson">cfloop Tag Example: Query</h2>

<cfquery name="qEmployees" datasource="cfdocexamples">


SELECT Emp_ID, FirstName, LastName FROM EMPLOYEES
</cfquery>

<cfoutput>
<table cellpadding="0" cellspacing="0" style="color:White"
border="1">
<tr bgcolor="HotPink">
<td><b>Emp_ID</b></td>
<td><b>FirstName</b></td>
<td><b>LastName</b></td>
</tr>
<cfloop query="qEmployees" startrow="1" endrow="10">
<tr bgcolor=#IIF(qEmployees.CurrentRow mod 2 eq
0,DE("IndianRed"),DE("Red"))#>
<td>#Emp_ID#</td>
<td>#FirstName#</td>
<td>#LastName#</td>
</tr>
</cfloop>
</table>
</cfoutput>

</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/cfloop-tag-example-how-to-loop-
over_1119.html
Example 109

cfloop tag example: how to loop over a time range in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfloop tag example: how to loop over a time range in
coldfusion</title>
</head>

<body>
<h2 style="color:Crimson">cfloop Tag Example: time range</h2>

<cfset LoopStartTime=CreateTime(0,0,0)>
<cfset LoopEndTime=CreateTime(5,0,0)>

<cfoutput>
<b>LoopStartTime:</b> #LoopStartTime#<br />
<b>LoopEndTime:</b> #LoopEndTime#<br />
</cfoutput>
<br /><br />

Loop start[step 30 minutes] ...<br />

<cfloop from="#LoopStartTime#" to="#LoopEndTime#" index="i"


step="#CreateTimeSpan(0,0,30,0)#">
<cfoutput>
<b>Current Position:</b> #TimeFormat(i)#<br />
</cfoutput>
</cfloop>

</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/cfloop-tag-example-how-to-loop-
over_2980.html
Example 110

cfmenu tag: how to create and use menu in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfmenu tag: how to create and use menu in coldfusion</title>
</head>

<body>
<h2 style="color:RosyBrown; font-style:italic">cfmenu example: how to
use</h2>
<hr width="500" align="left" color="RosyBrown" />
<br />

<cfmenu
name="MainMenu"
bgcolor="Wheat"
font="Tahoma, Geneva, sans-serif"
fontcolor="SaddleBrown"
fontsize="17"
selectedfontcolor="RosyBrown"
selecteditemcolor="MistyRose"
type="horizontal"
menustyle="border:solid; border-width:medium; font-weight:bold; text-
decoration:underline; color:SaddleBrown;"
>
<cfmenuitem display="Home" href="home.cfm"/>
<cfmenuitem display="Business" href="business.cfm"/>
<cfmenuitem
display="SoftWare"
href="softWare.cfm"
childstyle="border:solid; border-width:thin; font-weight:bold;
text-decoration:underline; color:Wheat; background-color:Tan;"
>
<cfmenuitem display="Flex" href="flex.cfm"/>
<cfmenuitem display="Photoshop" href="photoshop.cfm"/>
</cfmenuitem>
</cfmenu>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/06/cfmenu-tag-how-to-create-and-use-menu.html
Example 111

cfmenuitem tag: how to use cfmenuitem with cfmenu in


coldfusion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfmenuitem tag: how to use cfmenuitem with cfmenu in
coldfusion</title>
</head>

<body>
<h2 style="color:RosyBrown; font-style:italic">cfmenuitem example: how to
use</h2>
<hr width="500" align="left" color="RosyBrown" />
<br />

<cfmenu
name="MainMenu"
bgcolor="Crimson"
font="Arial, Helvetica, sans-serif"
fontcolor="SeaShell"
fontsize="17"
selectedfontcolor="Crimson"
selecteditemcolor="SeaShell"
type="horizontal"
menustyle="border:solid; border-width:medium; font-weight:bold;
color:SaddleBrown;"
>
<cfmenuitem display="Home" href="home.cfm"/>
<cfmenuitem display="Contact" href="contact.cfm"/>
<cfmenuitem
display="Product"
href="product.cfm"
childstyle="border:solid; border-width:thin; font-weight:bold;
text-decoration:underline; color:Snow; background-color:OrangeRed;"
>
<cfmenuitem display="Flex" href="flex.cfm"/>
<cfmenuitem display="Photoshop" href="photoshop.cfm"/>
</cfmenuitem>
<cfmenuitem display="Faq's" href="faqs.cfm"/>
</cfmenu>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/06/cfmenuitem-tag-how-to-use-cfmenuitem.html
Example 112

cfquery example: how to select data

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfquery example: how to select data</title>
</head>

<body>
<h2 style="color:crimson">cfquery example: how to select data</h2>
<cfquery name="qEmployee" datasource="cfdocexamples">
SELECT FirstName, LastName, Salary FROM Employee
</cfquery>
<cfdump var="#qEmployee#">
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/cfquery-example-how-to-select-data.html
Example 113

cfquery tag example: how to delete data

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfquery tag example: how to delete data</title>
</head>

<body>
<h2 style="color:hotpink">cfquery example: data delete</h2>

<cfquery name="qAuthorsDelete" datasource="cfbookclub"


result="AuthorsDelete">
DELETE FROM AUTHORS WHERE AuthorID>15
</cfquery>
<cfdump var="#AuthorsDelete#">
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/cfquery-tag-example-how-to-delete-data.html
Example 114

cfquery tag example: how to insert data

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfquery tag example: how to insert data</title>
</head>

<body>
<h2 style="color:hotpink">cfquery example: data insert</h2>
<cfquery name="qAuthorsInsert" datasource="cfbookclub"
result="AuthorsInsert">
INSERT INTO AUTHORS (FirstName, LastName) VALUES('Forta','Ben')
</cfquery>
<cfdump var="#AuthorsInsert#">

<cfquery name="qAuthors" datasource="cfbookclub">


SELECT AuthorID, LastName, FirstName FROM AUTHORS
</cfquery>
<cfdump var="#qAuthors#">
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/cfquery-tag-example-how-to-insert-data.html
Example 115

cfquery tag example: how to update data

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfquery tag example: how to update data</title>
</head>

<body>
<h2 style="color:hotpink">cfquery example: data update</h2>

<cfquery name="qAuthors" datasource="cfbookclub">


SELECT AuthorID, LastName, FirstName FROM AUTHORS
WHERE AuthorID=14
</cfquery>
<cfdump var="#qAuthors#">

<cfquery name="qAuthorsUpdate" datasource="cfbookclub"


result="AuthorUpdate">
UPDATE AUTHORS SET LastName='Forta', FirstName='Ben'
WHERE AuthorID=14
</cfquery>
<cfdump var="#AuthorUpdate#">

<cfquery name="qAuthors" datasource="cfbookclub">


SELECT AuthorID, LastName, FirstName FROM AUTHORS
WHERE AuthorID=14
</cfquery>
<cfdump var="#qAuthors#">

</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/cfquery-tag-example-how-to-update-data.html
Example 116

cfquery tag example: how to use result attribute

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfquery tag example: how to use result attribute</title>
</head>

<body>
<h2 style="color:hotpink">cfquery example: using result</h2>

<cfquery name="qMembers" datasource="cfcodeexplorer" result="members">


SELECT MemberID, lastname, FirstName, Email FROM MEMBERS
</cfquery>
<cfdump var="#Members#" label="Result">
<cfdump var="#qMembers#" label="Query">
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/cfquery-tag-example-how-to-use-result.html
Example 117

cfscript tag: How to create and use array in cfscript

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfscript tag: How to create and use array in cfscript</title>
</head>

<body>
<h2 style="color:DodgerBlue; font-style:italic">cfscript example:
Array</h2>
<hr width="350" align="left" color="PaleVioletRed" />
<br />

<cfscript>
ColorArray = ArrayNew(1);
temp = ArrayAppend(ColorArray,"Crimson");
temp = ArrayAppend(ColorArray,"Red");
temp = ArrayAppend(ColorArray,"SeaGreen");
temp = ArrayAppend(ColorArray,"OrangeRed");
</cfscript>

<cfif IsDefined("ColorArray")>
<cfdump var="#ColorArray#">
</cfif>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/04/cfscript-tag-how-to-create-and-use.html
Example 118

cfscript tag: how to assign variable in cfscript tag

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfscript tag: how to assign variable in cfscript tag</title>
</head>

<body>
<h2 style="color:DodgerBlue; font-style:italic">cfscript tag example:
assign variable</h2>
<hr width="350" align="left" color="PaleVioletRed" />
<br />

<cfscript>
firstNumber = 10;
secondNumber = 5;
sum = firstNumber+secondNumber;
WriteOutput("<h3 style='color:Crimson; font-weight:bold'>");
WriteOutput("Sum of two numbers [10+5]: ");
WriteOutput(sum);
WriteOutput("</h3>");
</cfscript>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/04/cfscript-tag-how-to-assign-variable-in.html
Example 119

How to use if else conditional statement in cfscript tag

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>How to use if else conditional statement in cfscript tag</title>
</head>

<body>
<h2 style="color:DodgerBlue; font-style:italic">cfscript example: if
else</h2>
<hr width="350" align="left" color="PaleVioletRed" />
<br />

<cfform name="HelloForm" method="post">


Name:
<cfinput type="text" name="UserName">
<cfinput name="Submit" type="submit" value="Submit">
</cfform>
<br />

<cfscript>
if (IsDefined("Form.Submit"))
{
if (Form.UserName neq "")
{
WriteOutput("Hello ");
WriteOutput(Form.UserName);
}
else
WriteOutput("Please input your name");
}
</cfscript>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/04/how-to-use-if-else-conditional.html
Example 120

cfscript tag: How to create and use structure in cfscript

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfscript tag: How to create and use structure in cfscript</title>
</head>

<body>
<h2 style="color:DodgerBlue; font-style:italic">cfscript example:
Structure</h2>
<hr width="350" align="left" color="PaleVioletRed" />
<br />

<cfscript>
ColorStruct = StructNew();
ColorStruct.Name = "BlueViolet";
ColorStruct.Value = "##8A2BE2";
</cfscript>

<cfif IsDefined("ColorStruct")>
<cfdump var="#ColorStruct#">
</cfif>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/04/cfscript-tag-how-to-create-and-use_21.html
Example 121

How to use switch, case, default statement in cfscript tag

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>How to use switch, case, default statement in cfscript tag</title>
</head>

<body>
<h2 style="color:DodgerBlue; font-style:italic">cfscript example: switch
statement</h2>
<hr width="350" align="left" color="PaleVioletRed" />
<br />

<cfform name="HelloForm" method="post">


Favorite Color:
<cfinput type="text" name="FavColor">
<cfinput name="Submit" type="submit" value="Submit">
</cfform>
<br />

<cfscript>
if (IsDefined("Form.Submit") and (Form.FavColor neq ""))
{
switch(Form.FavColor){
case "Crimson":
WriteOutput("Crimson is red type color");
break;
case "DodgerBlue":
WriteOutput("Crimson is blue type color");
break;
case "SeaGreen":
WriteOutput("Crimson is green type color");
break;
default:
WriteOutput("You input an unknown color.");
}
}
</cfscript>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/04/how-to-use-switch-case-default.html
Example 122

cfscript tag: How to call user defined function (UDFs) in cfscript

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfscript tag: How to call user defined function (UDFs) in
cfscript</title>
</head>

<body>
<h2 style="color:DodgerBlue; font-style:italic">cfscript example:
function call</h2>
<hr width="350" align="left" color="PaleVioletRed" />

<cffunction name="Hello" access="remote">


<cfargument name="userName" type="string">
<cfreturn "Hello #userName# !">
</cffunction>

<h3 style="color:SaddleBrown;">
<cfscript>
WriteOutput("#Hello("Jenny")#");
</cfscript>
</h3>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/04/cfscript-tag-how-to-call-user-defined.html
Example 123

cfscript tag: How to use do while loop in cfscript

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfscript tag: How to use do while loop in cfscript</title>
</head>

<body>
<h2 style="color:DodgerBlue; font-style:italic">cfscript example: do
while loop</h2>
<hr width="350" align="left" color="PaleVioletRed" />

<h4 style="color:SeaGreen;">
<cfscript>
counter = 1;
do{

WriteOutput("Current Position: #counter# <br />") ;


counter = counter+1;
}
while(counter LTE 6);
</cfscript>
</h4>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/04/cfscript-tag-how-to-use-do-while-loop.html
Example 124

cfscript tag: How to use for loop in cfscript

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfscript tag: How to use for loop in cfscript</title>
</head>

<body>
<h2 style="color:DodgerBlue; font-style:italic">cfscript example: for
loop</h2>
<hr width="350" align="left" color="PaleVioletRed" />

<h4 style="color:DarkBlue;">
<cfscript>
for(i=1; i LTE 10; i++){
WriteOutput("Current Position: #i# <br />") ;
}
</cfscript>
</h4>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/04/cfscript-tag-how-to-use-for-loop-in.html
Example 125

cfscript tag: How to create, call and use function in cfscript

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfscript tag: How to create, call and use function in
cfscript</title>
</head>

<body>
<h2 style="color:DodgerBlue; font-style:italic">cfscript example: create
function</h2>
<hr width="350" align="left" color="PaleVioletRed" />

<h3 style="color:CornflowerBlue;">
<cfscript>
function hello (userName){
sayHello = "Hello #userName# !";
return sayHello;
}
WriteOutput("#hello("Jones")#");
</cfscript>
</h3>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/04/cfscript-tag-how-to-create-call-and-use.html
Example 126

cfscript tag: How to get query result output in cfscript

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfscript tag: How to get query result output in cfscript</title>
</head>

<body>
<h2 style="color:DodgerBlue; font-style:italic">cfscript example: Query
Output</h2>
<hr width="350" align="left" color="PaleVioletRed" />

<cfquery name="qEmployee" datasource="cfdocexamples">


SELECT Emp_ID, FirstName, LastName FROM Employees
</cfquery>

<h3 style="color:RosyBrown; font-style:italic;">


<u>Employee List</u>
<br />
<cfscript>
for(Counter=1; Counter LTE qEmployee.RecordCount; Counter++)
{
WriteOutput(qEmployee.Emp_ID[Counter]);
WriteOutput(" : ");
WriteOutput(qEmployee.FirstName[Counter]);
WriteOutput(" ");
WriteOutput(qEmployee.LastName[Counter]);
WriteOutput("<br />");
}
</cfscript>
</h3>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/04/cfscript-tag-how-to-get-query-result.html
Example 127

cfselect tag: how to use cfselect with cfquery and static option

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion cfselect tag example: how to use cfselect with cfquery
and static option</title>
</head>

<body>
<h2 style="color:DodgerBlue">cfselect example: With cfquery and Static
option</h2>
<cfif IsDefined("Form.Submit")>
You selected Art: <cfoutput><b>#Form.Art#</b></cfoutput>
<br />
</cfif>

<cfquery name="qArt" datasource="cfartgallery">


SELECT ArtName FROM Art
</cfquery>

<cfform name="SelectTestForm" method="post" action="">


<cfselect name="Art" query="qArt" display="ArtName"
queryPosition="below">
<option>Select</option>
</cfselect>
<cfinput type="submit" name="Submit" value="Submit Art">
</cfform>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/03/cfselect-tag-how-to-use-cfselect-with.html
Example 128

cfselect tag: how to use cfselect with multiple selection mode

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion cfselect tag example: how to use cfselect with multiple
selection mode</title>
</head>

<body>
<h2 style="color:DodgerBlue">cfselect example: Multiple Selection</h2>
<cfif IsDefined("Form.Submit")>
You selected Employees: <cfoutput><b>#Form.Employee#</b></cfoutput>
<br /><br />
</cfif>

<cfquery name="qEmployee" datasource="cfdocexamples">


SELECT FirstName FROM Employee
</cfquery>

<cfform name="SelectTestForm" method="post" action="">


<cfselect
name="Employee"
query="qEmployee"
display="FirstName"
multiple="yes"
required="yes"
message="Select one"
>
</cfselect>
<br /><br />
<cfinput type="submit" name="Submit" value="Submit Employee">
</cfform>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/03/cfselect-tag-how-to-use-cfselect-
with_03.html
Example 129

cfsetting: how to use enablecfoutputonly attribute in cfsetting

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfsetting: how to use enablecfoutputonly attribute in
cfsetting</title>
</head>

<body>
<h2 style="color:DeepPink; font-style:italic">cfsetting tag example: how
to use enablecfoutputonly attribute</h2>
<hr width="600" align="left" color="OrangeRed" />
<br />

<cfset MyRandomNumber=RandRange(1,100)>

<cfsetting enablecfoutputonly="no">
<h3 style="color:SeaGreen">
My random number: <cfoutput>#MyRandomNumber#</cfoutput>
</h3>

<cfsetting enablecfoutputonly="yes">
<h3 style="color:SeaGreen">
My random number: <cfoutput>#MyRandomNumber#</cfoutput>
</h3>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/06/cfsetting-how-to-use-enablecfoutputonly.html
Example 130

cfsilent: how to use cfsilent for suppress output in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfsilent: how to use cfsilent for suppress output in
coldfusion</title>
</head>

<body>
<h2 style="color:DeepPink; font-style:italic">cfsilent tag example: how
to use cfsilent</h2>
<hr width="400" align="left" color="OrangeRed" />
<br />

<h3 style="color:DarkSeaGreen">
cfsilent tag block start...
</h3>
<cfsilent>
<cfquery name="qEmployee" datasource="cfdocexamples" maxrows="5">
SELECT Emp_ID, FirstName, LastName FROM EMPLOYEE
</cfquery>

<cfdump var="#qEmployee#">
</cfsilent>

<h3 style="color:DarkSeaGreen">
....cfsilent tag block end
</h3>

<cfdump label="Employee List" var="#qEmployee#">

</body>
</html>
http://coldfusion-example.blogspot.com/2009/06/cfsilent-how-to-use-cfsilent-for.html
Example 131

cfswitch tag example: how to use cfswitch tag with cfcase in


coldfusion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfswitch tag example: how to use cfswitch tag with cfcase in
coldfusion</title>
</head>

<body>
<h2 style="color:Crimson">cfswitch Tag Example</h2>

<cfquery name="qAuthor" datasource="cfbookclub">


SELECT AuthorID, FirstName, LastName FROM AUTHORS
</cfquery>

<cfset Theme="Pink">
<cfswitch expression="#Theme#">
<cfcase value="Pink">
<cfset HeaderRowColor="Crimson">
<cfset RegularRowColor="Pink">
<cfset AlternetRowColor="HotPink">
</cfcase>
<cfcase value="Green">
<cfset HeaderRowColor="Green">
<cfset RegularRowColor="SeaGreen">
<cfset AlternetRowColor="LightGreen">
</cfcase>
<cfdefaultcase>
<cfset HeaderRowColor="White">
<cfset RegularRowColor="White">
<cfset AlternetRowColor="White">
</cfdefaultcase>
</cfswitch>

<cfoutput>
<table cellpadding="0" cellspacing="0">
<tr bgcolor=#HeaderRowColor#>
<td><b>AuthorID</b></td>
<td><b>FirstName</b></td>
<td><b>LastName</b></td>
</tr>
<cfloop query="qAuthor">
<tr bgcolor=#IIF(qAuthor.CurrentRow mod 2 eq
0,DE(RegularRowColor),DE(AlternetRowColor))#>
<td>#AuthorID#</td>
<td>#FirstName#</td>
<td>#LastName#</td>
</tr>
</cfloop>
</table>
</cfoutput>

</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/cfswitch-tag-example-how-to-use.html
Example 132

cfcase tag: how to use delimiters attribute in cfcase tag with


cfswitch in coldfusion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfcase tag: how to use delimiters attribute in cfcase tag with
cfswitch in coldfusion</title>
</head>

<body>
<h2 style="color:OliveDrab; font-style:italic">cfcase tag example: how to
use delimiters attribute</h2>
<hr width="500" align="left" color="Olive" />
<br />

<cfif IsDefined("Form.SubmitColor")>
<cfoutput>
<h3 style="color:OrangeRed;">
<cfswitch expression="#Form.Color#">
<cfcase value="Red;Crimson;IndianRed" delimiters=";">
You choose red type color.
</cfcase>
<cfcase value="Orange;OrangeRed" delimiters=";">
You choose orange type color.
</cfcase>
<cfcase value="DodgerBlue;CornFlowerBlue;Blue"
delimiters=";">
You choose blue type color.
</cfcase>
<cfdefaultcase>
You choose unknown type color.
</cfdefaultcase>
</cfswitch>
</h3>
</cfoutput>
</cfif>

<cfform name="cfcaseTest" method="post" format="html">


<table border="1" cellpadding="5" cellspacing="0" bordercolor="Orange">
<tr>
<td colspan="2" bgcolor="DeepPink" style="color:Snow; font-
size:large" align="center">
Submit Color
</td>
</tr>
<tr height="100" valign="top">
<td style="color:RosyBrown; font-weight:bold">
Color Name
</td>
<td>
<cfinput
name="Color"
type="text"
style="background-color:Wheat; color:RosyBrown;
width:250px; height:25px; font-size:large; font-style:italic; font:'Comic
Sans MS', cursive"
autosuggest=
"Red,Crimson,IndianRed,Orange,OrangeRed,DodgerBlue,CornFlowerBlue,Blue"
>
</td>
</tr>
<tr>
<td colspan="2" align="right">
<cfinput
name="SubmitColor"
type="submit"
value="Submit"
style="height:45px; width:150px; font-size:large;
font-style:italic; font-weight:bold; color:OliveDrab;"
>
</td>
</tr>
</table>
</cfform>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/06/cfcase-tag-how-to-use-delimiters.html
Example 133

cfcol tag example: how to use cfcol tag in cftable tag in


coldfusion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfcol tag example: how to use cfcol tag in cftable tag in
coldfusion</title>
</head>

<body>
<h2 style="color:Crimson">cfcol Tag Example</h2>

<cfquery name="qSponsors" datasource="cfbookclub">


SELECT SponsorID, SponsorName, WebAddress, City, State FROM SPONSORS
</cfquery>

<cftable
query="qSponsors"
border="yes"
maxrows="10"
startrow="1"
colspacing="1"
colheaders="yes"
>
<cfcol header="Sponsor ID" align="left" text="#SponsorID#">
<cfcol header="Sponsor Name" align="left" text="#SponsorName#">
<cfcol header="Web Address" align="left" text="#WebAddress#">
<cfcol header="City" align="left" text="#City#">
<cfcol header="State" align="left" text="#State#">
</cftable>
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/cfcol-tag-example-how-to-use-cfcol-tag.html
Example 134

cftable tag example: how to build a table in coldfusion (HTML


Table)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cftable tag example: how to build a table in coldfusion (HTML
Table)</title>
</head>

<body>
<h2 style="color:Crimson">cftable Tag Example: HTML Table</h2>

<cfquery name="qAuthors" datasource="cfbookclub">


SELECT AuthorID, FirstName, LastName FROM AUTHORS
</cfquery>

<cftable
query="qAuthors"
border="yes"
maxrows="8"
startrow="1"
colspacing="1"
colheaders="yes"
htmltable="yes"
headerlines="1"
>
<cfcol header="Author ID" align="left" text="#AuthorID#">
<cfcol header="First Name" align="left" text="#FirstName#">
<cfcol header="Last Name" align="left" text="#LastName#">
</cftable>
</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/cftable-tag-example-how-to-build-
table_31.html
Example 135

cftextarea tag: how to use rich text area with basic toolbar in
coldfusion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cftextarea tag: how to use rich text area with basic toolbar in
coldfusion</title>
</head>

<body>
<h2 style="color:SaddleBrown; font-style:italic">cftextarea example: how
to use rich text area</h2>
<hr width="450" align="left" color="SaddleBrown" />
<br />

<cfif IsDefined("Form.SubmitColors")>
<cfoutput>
<h3 style="color:DeepPink;">
Your favorite colors are: #Form.Colors#
</h3>
</cfoutput>
</cfif>

<cfform name="RichTextAreaTest" method="post" format="html">


<table border="1" cellpadding="5" cellspacing="0"
bordercolor="CornFlowerBlue">
<tr>
<td colspan="2" bgcolor="DodgerBlue" style="color:Snow; font-
size:large" align="center">
Favorite Colors Submit Form
</td>
</tr>
<tr valign="top">
<td style="color:DodgerBlue; font-weight:bold">
Favorite Colors
</td>
<td width="250">
<cftextarea
name="Colors"
required="yes"
message="Colors required."
richtext="yes"
toolbar="Basic"
/>
</td>
</tr>
<tr>
<td colspan="2" align="right">
<cfinput
name="SubmitColors"
type="submit"
value="Submit"
style="height:45px; width:150px; font-size:large;
font-style:italic; font-weight:bold; color:DodgerBlue;"
>
</td>
</tr>
</table>
</cfform>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/06/cftextarea-tag-how-to-use-rich-text.html
Example 136

cftry and cfcatch tag example: how to catch exception and


handle error
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cftry and cfcatch tag example: how to catch exception and handle
error</title>
</head>

<body>
<h2 style="color:DodgerBlue">ColdFusion cftry and cfcatch example</h2>

<cftry>
<!---Here i input wrong table name--->
<cfquery name="qEmployee" datasource="cfdocexamples">
SELECT * FROM Employeess
</cfquery>
<cfdump var="#qEmployee#">

<cfcatch type="any">
<cfoutput>
Error occured....<br /><br />
Message: <b>#cfcatch.Message#</b><br />
Detail: <b>#cfcatch.Detail#</b><br />
Type: <b>#cfcatch.Type#</b><br />
</cfoutput>
</cfcatch>
</cftry>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/04/cftry-and-cfcatch-tag-example-how-to.html
Example 137

cfabort tag example: how to stop the processing of a coldfusion


page at the tag location
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfabort tag example: how to stop the processing of a coldfusion
page at the tag location</title>
</head>

<body>
<h2 style="color:Crimson">cfabort Tag Example</h2>

<cfloop from="1" to="25" index="LoopCounter" >


<cfoutput>
<b>Current LoopCounter:</b> #LoopCounter#
<br />
<cfif LoopCounter EQ 5>
<cfabort showerror="cfabort call at the position 5">
</cfif>
</cfoutput>
</cfloop>

</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/cfabort-tag-example-how-to-stop.html
Example 138

cfbreak tag example: how to use cfbreak tag to break a loop

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfbreak tag example: how to use cfbreak tag to break a
loop</title>
</head>

<body>
<h2 style="color:Crimson">cfbreak Tag Example</h2>

<cfloop from="1" to="10" index="Counter" >


<cfoutput>
<b>Current Counter:</b> #Counter#
<br />
<cfif Counter EQ 6>
loop break at the position 6
<cfbreak>
</cfif>
</cfoutput>
</cfloop>

<br /><br />


Other code goes here...

</body>
</html>
http://coldfusion-example.blogspot.com/2008/12/cfbreak-tag-example-how-to-use-cfbreak.html
Example 139

cfcache tag: how to cache web page in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfcache tag: how to cache web page in coldfusion</title>
</head>

<body>
<h2 style="color:SteelBlue; font-style:italic">cfcache tag example: how
to cache web pages</h2>
<hr width="450" align="left" color="SteelBlue" />
<br />

<cfcache timespan="#CreateTimeSpan(0,0,5,0)#">

<cfoutput>
<h3 style="color:DeepPink">
This page create at #TimeFormat(Now())# and cache for 5 minutes.
</h3>
</cfoutput>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/06/cfcache-tag-how-to-cache-web-page-in.html
Example 140

ColdFusion cfdbinfo tag example: how to get column list from a


table
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion cfdbinfo tag example: how to get column list from a
table</title>
</head>

<body>
<h2 style="color:DodgerBlue">ColdFusion cfdbinfo tag example: Column
List</h2>

<cfdbinfo datasource="cfbookclub" table="Books" type="columns"


name="result">

<cfquery dbtype="query" name="qColumnList">


SELECT COLUMN_NAME FROM result
</cfquery>

<cfdump var="#qColumnList#">
</body>
</html>
http://coldfusion-example.blogspot.com/2009/02/cfdbinfo-tag-example-how-to-get-column.html
Example 141

cfflush: how to use interval attribute with cfflush in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfflush: how to use interval attribute with cfflush in
coldfusion</title>
</head>

<body>
<h2 style="color:DeepPink; font-style:italic">cfflush tag example: how to
use cfflush</h2>
<hr width="400" align="left" color="OrangeRed" />
<br />

<cfflush interval="1">

<cfoutput>
<cfloop index="i" from=1 to="500000">
<cfif i EQ 100000 or i EQ 200000 or i EQ 300000 or i EQ 400000
or i EQ 500000>
<h3 style="color:SeaGreen">
The loop current index is: #i#
<br />
</h3>
</cfif>
</cfloop>
</cfoutput>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/06/cfflush-how-to-use-interval-attribute.html
Example 142

cflocation tag: how to redirect a page with token

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion cflocation tag example: how to redirect a page with
token</title>
</head>

<body>
<h2 style="color:DodgerBlue">cflocation example: How to Redirect</h2>

<cflocation
url="http://coldfusion-example.blogspot.com/"
addtoken="yes"
>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/03/cflocation-tag-how-to-redirect-page.html
Example 143

How to create authentication system (cflogin, cfloginuser,


cflogout) in coldfusion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>How to create authentication system (cflogin, cfloginuser,
cflogout) in coldfusion</title>
</head>

<body>
<h2 style="color:OrangeRed; font-style:italic">cfloginuser tag example:
how to create simple login logout system</h2>
<hr width="625" align="left" color="Crimson" />
<br />

<cfif IsDefined("LoginButton")>
<cfif Form.UserName eq "jenny" and Form.Password eq "password">
<cflogin>
<cfloginuser name="jenny" password="password" roles="admin">
</cflogin>
</cfif>
</cfif>

<cfif IsDefined("LogoutButton")>
<cflogout>
</cfif>

<cfif IsUserLoggedIn() eq "Yes">


<cfform action="" method="post" name="LogoutForm">
<cfinput
type="submit"
name="LogoutButton"
value="Logout"
style="height:45px; width:150px; font-size:large; font-
style:italic; font-weight:bold; color:DeepPink;"
>
</cfform>
<h3 style="color:SeaGreen;">
Only logged in user can see this image.
</h3>
<img src="Images/CuteBird.jpg" />
</cfif>

<cfif IsUserLoggedIn() eq "No">


<cfform name="LoginForm" method="post" format="html">
<table border="1" cellpadding="5" cellspacing="0"
bordercolor="SeaGreen">
<tr>
<td colspan="2" bgcolor="DarkSeaGreen" style="color:Snow;
font-size:large" align="center">
User Login Form
</td>
</tr>
<tr valign="top">
<td style="color:OliveDrab; font-weight:bold">
UserName
</td>
<td style="color:Crimson;">
<cfinput
name="UserName"
type="text"
style="background-color:OliveDrab; color:Snow;
width:250px; height:25px; font-size:large; font-style:italic; font:'Comic
Sans MS', cursive"
>
*jenny
</td>
</tr>
<tr valign="top">
<td style="color:OliveDrab; font-weight:bold">
Password
</td>
<td style="color:Crimson;">
<cfinput
name="Password"
type="password"
style="background-color:OliveDrab; color:Snow;
width:250px; height:25px; font-size:large; font-style:italic; font:'Comic
Sans MS', cursive"
>
*password
</td>
</tr>
<tr valign="top">
<td colspan="2" align="right">
<cfinput
type="submit"
name="LoginButton"
value="Login"
style="height:45px; width:150px; font-size:large;
font-style:italic; font-weight:bold; color:OliveDrab;"
>
</td>
</tr>
</table>
</cfform>
</cfif>
<br />

</body>
</html>
http://coldfusion-example.blogspot.com/2009/06/how-to-create-authentication-system.html
Example 144

cfqueryparam and cfsqltype - how to use cfsqltype in


cfqueryparam tag
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfqueryparam and cfsqltype - how to use cfsqltype in
cfqueryparam tag</title>
</head>

<body>
<h2 style="color:DarkBlue; font-style:italic">ColdFusion cfqueryparam tag
example: how to use cfsqltype</h2>
<hr width="600" align="left" color="PowderBlue" />
<br />

<cfparam name="url.EmpID" default="0">

<cfquery name="qEmploees" datasource="cfdocexamples">


select Emp_ID, FirstName, LastName from Employee
where Emp_ID = <cfqueryparam value="#url.EmpID#"
cfsqltype="cf_sql_integer">
</cfquery>

<div style=" font-family:'Lucida Sans Unicode', 'Lucida Grande', sans-


serif; font-size:large;">
<a href="Usingcfsqltype.cfm?EmpID=1">Employee ID = 1</a> <br />
<a href="Usingcfsqltype.cfm?EmpID=2">Employee ID = 2</a> <br />
<a href="Usingcfsqltype.cfm?EmpID=3">Employee ID = 3</a> <br />
</div>
<br />

<table border="0" cellpadding="2" cellspacing="2" bgcolor="OrangeRed"


width="350">
<tr style="background-color:DeepPink; color:Snow; font-weight:bold;">
<td>
Employee ID
</td>
<td>
First Name
</td>
<td>
Last Name
</td>
</tr>
<cfoutput query="qEmploees">
<tr style="color:Snow; background-color:HotPink; font-
family:'Courier New', Courier, monospace;">
<td>
#EmpID#
</td>
<td>
#FirstName#
</td>
<td>
#LastName#
</td>
</tr>
</cfoutput>
</table>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/12/cfqueryparam-and-cfsqltype-how-to-use.html
Example 145

Ajax: how to disable layout tab programmatically in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ajax: how to disable layout tab programmatically in
coldfusion</title>
</head>

<body>
<h2 style="color:SeaGreen; font-style:italic">Ajax Example:
ColdFusion.Layout.disableTab</h2>
<hr width="500" align="left" color="LightPink" />
<br />

<a
href="JavaScript:ColdFusion.Layout.disableTab('ImageLayout','CuteFish')">
<b>Disable Tab [Cute Fish]</b>
</a>
<br /><br />

<cflayout name="ImageLayout" type="tab" style="width:475px">


<cflayoutarea name="BeeTab" title="Bee Image">
<img src="Images/Bee.jpg" />
</cflayoutarea>
<cflayoutarea name="CuteFish" title="Cute Fish">
<img src="Images/Fish.jpg" />
</cflayoutarea>
</cflayout>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/ajax-how-to-disable-layout-tab.html
Example 146

Ajax: how to enable layout tab programmatically in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ajax: how to enable layout tab programmatically in
coldfusion</title>
</head>

<body>
<h2 style="color:Crimson; font-style:italic">Ajax Example:
ColdFusion.Layout.enableTab</h2>
<hr width="500" align="left" color="LightPink" />
<br />

<a
href="JavaScript:ColdFusion.Layout.enableTab('ImageLayout','SecondTab')">
<b>Enable Tab [Second Bee Tab]</b>
</a>
<br /><br />

<cflayout name="ImageLayout" type="tab" style="width:500px">


<cflayoutarea name="FirstTab" title="Bee Image">
<img src="Images/Bee1.jpg" />
</cflayoutarea>
<cflayoutarea name="SecondTab" title="Second Bee Tab"
disabled="true">
<img src="Images/Bee2.jpg" />
</cflayoutarea>
</cflayout>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/ajax-how-to-enable-layout-tab.html
Example 147

Ajax: how to hide layout tab programmatically in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ajax: how to hide layout tab programmatically in
coldfusion</title>
</head>

<body>
<h2 style="color:Crimson; font-style:italic">Ajax Example:
ColdFusion.Layout.hideTab</h2>
<hr width="500" align="left" color="LightPink" />
<br />

<a href="JavaScript:ColdFusion.Layout.hideTab('HideTestLayout','Tab2')">
<b>Hide Tab [Second Elephant Tab]</b>
</a>
<br /><br />

<cflayout name="HideTestLayout" type="tab" style="width:400px">


<cflayoutarea name="ElephantTab" title="Elephant Image">
<img src="Images/Elephant.jpg" />
</cflayoutarea>
<cflayoutarea name="Tab2" title="Second Elephant Tab">
<img src="Images/Elephant1.jpg" />
</cflayoutarea>
</cflayout>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/ajax-how-to-hide-layout-tab.html
Example 148

Ajax: how to select layout tab programmatically in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ajax: how to select layout tab programmatically in
coldfusion</title>
</head>

<body>
<h2 style="color:Crimson; font-style:italic">Ajax Example:
ColdFusion.Layout.selectTab</h2>
<hr width="500" align="left" color="LightPink" />
<br />

<a href=
"JavaScript:ColdFusion.Layout.selectTab('HideTestLayout','CartoonTab')">
<b>Select Tab [Cartoon Tab]</b>
</a>
<br /><br />

<cflayout name="HideTestLayout" type="tab" style="width:550px">


<cflayoutarea name="FishTab" title="Fish Tab">
<img src="Images/Fish8.jpg" />
</cflayoutarea>
<cflayoutarea name="CartoonTab" title="Cartoon Tab">
<img src="Images/Fish9.jpg" />
</cflayoutarea>
</cflayout>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/ajax-how-to-select-layout-tab.html
Example 149

Ajax: how to show layout tab programmatically in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ajax: how to show layout tab programmatically in
coldfusion</title>
</head>

<body>
<h2 style="color:Crimson; font-style:italic">Ajax Example:
ColdFusion.Layout.showTab</h2>
<hr width="500" align="left" color="LightPink" />
<br />

<a href="JavaScript:ColdFusion.Layout.showTab('HideTestLayout','Tab2')">
<b>Show Tab [Second Tab]</b>
</a>
<br /><br />

<cflayout name="HideTestLayout" type="tab" style="width:400px">


<cflayoutarea name="Tab1" title="Fish Image">
<img src="Images/Fish6.jpg" />
</cflayoutarea>
<cflayoutarea name="Tab2" title="Second Tab" inithide="true">
<img src="Images/Fish7.jpg" />
</cflayoutarea>
</cflayout>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/ajax-how-to-show-layout-tab.html
Example 150

Ajax JavaScript Function: how to create window


programmatically with custom settings
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ajax JavaScript Function: how to create window programmatically
with custom settings</title>
</head>

<body>
<h2 style="color:Crimson; font-style:italic">Ajax JavaScript Function
example: ColdFusion.Window.create</h2>
<hr width="600" align="left" color="CadetBlue" />
<br />

<cfajaximport tags="cfwindow">

<a href="JavaScript:ColdFusion.Window.create('ButterflyWindow','Butterfly
Image','Butterfly.cfm',{height:375,
width:450,x:25,y:150,draggable:false,closable:false})">
<b>Show Butterfly Image Window</b>
</a>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/ajax-javascript-function-how-to-create.html
Example 151

Ajax JavaScript Function: how to use


ColdFusion.Window.onHide in coldfusion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="javascript">
function onhide(windowName) {
alert(windowName + " window now hide!");
}

function linkClick() {
ColdFusion.Window.onHide("ButterflyImageWindow", onhide);
ColdFusion.Window.hide("ButterflyImageWindow");
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ajax JavaScript Function: how to use ColdFusion.Window.onHide in
coldfusion</title>
</head>

<body>

<h2 style="color:DeepPink; font-style:italic">Ajax JavaScript Function


example: ColdFusion.Window.onHide</h2>
<hr width="600" align="left" color="Beige" />
<br />

<a href="JavaScript:linkClick()">
<b>Hide the Window</b>
</a>

<cfwindow
name="ButterflyImageWindow"
title="Butterfly Image Explorere"
initshow="true"
x="25"
y="150"
height="400"
width="485"
closable="false"
draggable="false"
>
<img src="Images/Butterfly9.jpg" height="321" width="450" />
</cfwindow>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/ajax-javascript-function-how-to-use_01.html
Example 152

Ajax JavaScript Function: how to use


ColdFusion.Window.onShow in coldfusion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="javascript">
function onhide(windowName) {
alert(windowName + " window now visible!");
}

function showLinkClick() {
ColdFusion.Window.onShow("ButterflyWindow", onhide);
ColdFusion.Window.show("ButterflyWindow");
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ajax JavaScript Function: how to use ColdFusion.Window.onShow in
coldfusion</title>
</head>

<body>

<h2 style="color:SeaGreen; font-style:italic">Ajax JavaScript Function


example: ColdFusion.Window.onShow</h2>
<hr width="600" align="left" color="Beige" />
<br />

<a href="JavaScript:showLinkClick()">
<b>Show the Window</b>
</a>

<cfwindow
name="ButterflyWindow"
title="Butterfly Image"
x="25"
y="150"
height="350"
width="510"
closable="false"
draggable="false"
initshow="false"
>
<img src="Images/Butterfly10.jpg" height="287" width="468" />
</cfwindow>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/ajax-javascript-function-how-to-use.html
Example 153

Ajax JavaScript Function: how to show hide window


programmatically in coldfusion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ajax JavaScript Function: how to show hide window programmatically
in coldfusion</title>
</head>

<body>
<h2 style="color:DeepPink; font-style:italic">Ajax JavaScript Function
example: Window Show Hide</h2>
<hr width="550" align="left" color="Olive" />
<br />

<a href="JavaScript:ColdFusion.Window.show('CuteFlower')">
<b>Show the Window</b>
</a>

<a href="JavaScript:ColdFusion.Window.hide('CuteFlower')">
<b>Hide the Window</b>
</a>

<cfwindow name="CuteFlower" title="Cute Flower Image">


<img src="Images/CuteFlower.jpg" width="400" height="400"/>
</cfwindow>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/04/ajax-javascript-function-how-to-show_29.html
Example 154

Ajax JavaScript Function: how to show window


programmatically in coldfusion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ajax JavaScript Function: how to show window programmatically in
coldfusion</title>
</head>

<body>
<h2 style="color:Olive; font-style:italic">Ajax JavaScript Function
example: ColdFusion.Window.show</h2>
<hr width="550" align="left" color="Beige" />
<br />

<a href="JavaScript:ColdFusion.Window.show('ImageExplorer')">
<b>Click here for show the window</b>
</a>

<cfwindow name="ImageExplorer" title="Image Explorere">


<img src="Images/Flower.gif" width="350" height="350" />
</cfwindow>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/04/ajax-javascript-function-how-to-show.html
Example 155

Ajax JavaScript Function: how to hide window


programmatically in coldfusion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ajax JavaScript Function: how to hide window programmatically in
coldfusion</title>
</head>

<body>
<h2 style="color:CornflowerBlue; font-style:italic">Ajax JavaScript
Function example: ColdFusion.Window.hide</h2>
<hr width="550" align="left" color="Beige" />
<br />

<a href="JavaScript:ColdFusion.Window.hide('ImageExplorer')">
<b>Click for hide the window</b>
</a>

<cfwindow name="ImageExplorer" title="Image Explorere" initshow="true">


<img src="Images/Cat2.jpg" />
</cfwindow>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/04/ajax-javascript-function-how-to-hide.html
Example 156

cfajaximport tag: how to use cfajaximport for using ajax feature


in coldfusion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfajaximport tag: how to use cfajaximport for using ajax feature
in coldfusion</title>
</head>

<body>
<h2 style="color:DeepPink; font-style:italic">cfajaximport tag example:
how to use</h2>
<hr width="400" align="left" color="OrangeRed" />
<br />

<cfajaximport tags="cfwindow">

<a href="JavaScript:ColdFusion.Window.create('ImageWindow','Butterfly
Image','Image.cfm',{width:450, height:375})">
<h3 style="color:RosyBrown">
<b>Click to see butterfly image</b>
</h3>
</a>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/06/cfajaximport-tag-how-to-use.html
Example 157

How to use cflayout with type hbox and cfpod

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion cflayout tag example: how to use cflayout with type
hbox and cfpod</title>
</head>

<body>
<h2 style="color:DodgerBlue">cflayout example: How to use</h2>
<cflayout name="ImageExplorer" type="hbox">
<cflayoutarea name="OrchidImage">
<cfpod
title="Orchid"
height="400"
width="475"
>
<img src="./Images/Orchid.jpg" />
</cfpod>
</cflayoutarea>
<cflayoutarea name="Orchid1Image">
<cfpod
title="Orchid"
height="300"
width="360"
>
<img src="./Images/Orchid1.jpg" />
</cfpod>
</cflayoutarea>
</cflayout>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/03/how-to-use-cflayout-with-type-hbox-and.html
Example 158

How to use cflayout with cflayoutarea, type tab and tab


position bottom
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>How to use cflayout with cflayoutarea, type tab and tab position
bottom</title>
</head>

<body>
<h2 style="color:DodgerBlue">ColdFusion cflayout example: With
cflayoutarea</h2>
<cflayout type="tab" tabposition="bottom">
<cflayoutarea title="Doll">
<img src="./Images/Doll.jpg"/>
</cflayoutarea>
<cflayoutarea title="Doll1">
<img src="./Images/Doll1.jpg"/>
</cflayoutarea>
<cflayoutarea title="Doll2">
<img src="./Images/Doll2.jpg"/>
</cflayoutarea>
</cflayout>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/03/how-to-use-cflayout-with-cflayoutarea.html
Example 159

How to use cflayout with type vbox and cfpod

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>How to use cflayout with type vbox and cfpod</title>
</head>

<body>
<h2 style="color:DodgerBlue">ColdFusion cflayout example: Type vbox</h2>
<cflayout name="ImageExplorer" type="vbox">
<cflayoutarea name="OrchidImage">
<cfpod
title="Flower"
height="200"
width="250"
>
<img src="./Images/Flower.jpg" width="75%" height="75%" />
</cfpod>
</cflayoutarea>
<cflayoutarea name="Orchid1Image">
<cfpod
title="Flower 1"
height="200"
width="250"
>
<img src="./Images/Flower2.jpg" width="75%" height="75%" />
</cfpod>
</cflayoutarea>
</cflayout>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/03/how-to-use-cflayout-with-type-vbox-and.html
Example 160

cflayout tag: how to create a border type layout in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cflayout tag: how to create a border type layout in
coldfusion</title>
</head>

<body>
<h2 style="color:DimGray; font-style:italic">cflayout example: layout
type border</h2>
<hr width="500" align="left" color="LightPink" />
<br />

<cflayout name="BorderLayout" type="border" style="height:400px;


width:450px;text-align:center">
<cflayoutarea name="TopBar" position="top" style="height:75px;">
Top Area: Height 75px
</cflayoutarea>
<cflayoutarea name="LeftBar" position="left" style="width:75px">
Left
</cflayoutarea>
<cflayoutarea name="CentarBar" position="center">
Center
</cflayoutarea>
<cflayoutarea name="RightBar" position="right" style="width:100px">
Right
</cflayoutarea>
</cflayout>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cflayout-tag-how-to-create-border-type.html
Example 161

cflayout tag: how to create closable layout area in a border type


layout
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cflayout tag: how to create closable layout area in a border type
layout</title>
</head>

<body>
<h2 style="color:SeaGreen; font-style:italic">cflayout example: closable
layoutarea</h2>
<hr width="550" align="left" color="LightPink" />
<br />

<cflayout name="BorderLayout" type="border" style="height:550px;


width:500px; text-align:center">
<cflayoutarea name="TopBar" position="top">
Top
</cflayoutarea>
<cflayoutarea name="LeftBar" position="left" closable="true"
style="width:75px">
Left
</cflayoutarea>
<cflayoutarea name="CentarBar" position="center">
<img src="Images/Dolphin.JPG" />
</cflayoutarea>
<cflayoutarea name="RightBar" position="right" closable="true"
style="width:75px">
Right
</cflayoutarea>
<cflayoutarea name="BottomBar" position="bottom">
Bottom
</cflayoutarea>
</cflayout>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cflayout-tag-how-to-create-closable.html
Example 162

cflayout tag: how to create collapsible layout area in a border


type layout
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cflayout tag: how to create collapsible layout area in a border
type layout</title>
</head>

<body>
<h2 style="color:SaddleBrown; font-style:italic">cflayout example:
collapsible layoutarea</h2>
<hr width="550" align="left" color="LightPink" />
<br />

<cflayout name="BorderLayout" type="border" style="height:450px;


width:575px; text-align:center">
<cflayoutarea name="TopBar" position="top">
Top
</cflayoutarea>
<cflayoutarea name="LeftBar" position="left" closable="true"
style="width:75px" collapsible="true">
Left
</cflayoutarea>
<cflayoutarea name="CenterBar" position="center">
<img src="Images/Dolphin1.JPG" />
</cflayoutarea>
<cflayoutarea name="RightBar" position="right" closable="true"
collapsible="true" style="width:75px">
Right
</cflayoutarea>
<cflayoutarea name="BottomBar" position="bottom">
Bottom
</cflayoutarea>
</cflayout>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cflayout-tag-how-to-create-collapsible.html
Example 163

cflayout tag: how to use splitter in a border type layout in


coldfusion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cflayout tag: how to use splitter in a border type layout in
coldfusion</title>
</head>

<body>
<h2 style="color:SeaGreen; font-style:italic">cflayout example: using
splitter in border type layout</h2>
<hr width="550" align="left" color="LightPink" />
<br />

<cflayout name="BorderLayout" type="border" style="height:400px;


width:650px; text-align:center">
<cflayoutarea name="TopBar" position="top" splitter="true">
Top
</cflayoutarea>
<cflayoutarea name="LeftBar" position="left" splitter="true">
Left
</cflayoutarea>
<cflayoutarea name="CenterBar" position="center">
<img src="Images/Dolphin2.JPG" />
</cflayoutarea>
<cflayoutarea name="RightBar" position="right" splitter="true">
Right
</cflayoutarea>
<cflayoutarea name="BottomBar" position="bottom" splitter="true">
Bottom
</cflayoutarea>
</cflayout>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/05/cflayout-tag-how-to-use-splitter-in.html
Example 164

How to use cfpod with inline content

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion cfpod tag example: how to use cfpod with inline
content</title>
</head>

<body>
<h2 style="color:DodgerBlue">cfpod example: InLine Content</h2>
<cfpod
title="Sea Fish"
height="325"
width="495"
>
<img src="./Images/Fish.jpg" />
</cfpod>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/03/how-to-use-cfpod-with-inline-content.html
Example 165

cfpresentation tag: how to use cfpresentation in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfpresentation tag: how to use cfpresentation in
coldfusion</title>
</head>

<body>

<cfpresentation title="Image Viewer">


<cfpresentationslide title="Cat Image" duration="10">
<h3 style="color:DeepPink; font-style:italic;">
Cat Image
</h3>
<img src="Images/Cat.jpg" />
</cfpresentationslide>
<cfpresentationslide title="Rat Image" duration="10">
<h3 style="color:Crimson; font-style:italic;">
Rat Image
</h3>
<img src="Images/Rat.jpg" />
</cfpresentationslide>
</cfpresentation>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/04/cfpresentation-tag-how-to-use.html
Example 166

cfpresenter tag: how to show presenter data in cfpresentation

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfpresenter tag: how to show presenter data in
cfpresentation</title>
</head>

<body>

<cfquery name="qEmployee" datasource="cfdocexamples" maxrows="10">


SELECT Emp_ID, FirstName, LastName, Email, Department FROM Employees
</cfquery>

<cfoutput>
<cfpresentation title="Dog Show">
<cfpresenter name="Jenny Jones" email="Jones@www.www">
<cfpresenter name="Raymond Roy" email="Raymond@www.www">
<cfpresentationslide title="Forest Dog" duration="30"
presenter="Jenny Jones">
<h4 style="color:LightSlateGray;">
Forest Dog
</h4>
<img src="Images/Dog2.jpg" />
</cfpresentationslide>
<cfpresentationslide title="Cute Dog" duration="30"
presenter="Raymond Roy">
<h4 style="color:DarkSalmon;">
Cute Dog
</h4>
<img src="Images/Dog3.jpg" />
</cfpresentationslide>
</cfpresentation>
</cfoutput>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/04/cfpresenter-tag-how-to-show-presenter.html
Example 167

cfpresentation tag: how to present query data in cfpresentation

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfpresentation tag: how to present query data in
cfpresentation</title>
</head>

<body>

<cfquery name="qEmployee" datasource="cfdocexamples" maxrows="10">


SELECT Emp_ID, FirstName, LastName, Email, Department FROM Employees
</cfquery>

<cfoutput>
<cfpresentation title="Employee Data">
<cfloop query="qEmployee">
<cfpresentationslide title="Employee ID [#qEmployee.Emp_ID#]"
duration="15">
<h4 style="color:LightSlateGray;">
<br />
Employee ID: #qEmployee.Emp_ID# <br />
Department: #qEmployee.Department# <br />
Name: #qEmployee.FirstName# #qEmployee.LastName# <br />
Email: #qEmployee.Email#
</h4>
</cfpresentationslide>
</cfloop>
</cfpresentation>
</cfoutput>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/04/cfpresentation-tag-how-to-present-query.html
Example 168

cfslider tag: how to use cfslider in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfslider tag: how to use cfslider in coldfusion</title>
</head>

<body>
<h2 style="color:DeepPink; font-style:italic">cfslider tag example: how
to use</h2>
<hr width="400" align="left" color="OrangeRed" />
<br />

<cfparam name="Form.AngleSlider" default="0">

<table border="1" cellpadding="5" cellspacing="0" bordercolor="Orange">


<tr valign="top" style="color:RosyBrown; font-weight:bold">
<td colspan="2">
<cfform name="SliderTestForm" method="post">
Angle
<cfslider
name="AngleSlider"
value="180"
range="0,360"
label="Value: "
refreshlabel="yes"
width="360"
height="50"
>360
<cfinput
type="submit"
name="SubmitButton"
value="RotateImage"
style="height:45px; width:150px; font-size:large;
font-style:italic; font-weight:bold; color:SeaGreen;"
/>
</cfform>
</td>
</tr>
<tr bgcolor="OrangeRed" style="color:Snow; font-size:large"
align="center">
<td>
Original Image
</td>
<td>
Image Rotate <cfoutput>#Form.AngleSlider#</cfoutput>
</td>
</tr>
<tr valign="top" style="color:RosyBrown; font-weight:bold">
<td>
<img src="Images/Butterfly8.jpg"/>
</td>
<td>
<cfimage action="rotate" angle="#Form.AngleSlider#"
source="Images/Butterfly8.jpg" name="ModifiedImage">
<cfimage action="writetobrowser" source="#ModifiedImage#">
</td>
</tr>
</table>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/06/cfslider-tag-how-to-use-cfslider-in.html
Example 169

cfwindow tag: how to use cfwindow in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cfwindow tag: how to use cfwindow in coldfusion</title>
</head>

<body>
<h2 style="color:DodgerBlue; font-style:italic">cfwindow tag example: how
to use</h2>
<hr width="400" align="left" color="CadetBlue" />
<br />

<cfwindow
name="FlowerWindow"
title="Flower Image"
initshow="true"
modal="false"
resizable="false"
height="450"
width="550"
>
<img src="Images/Flowers.gif"/>
</cfwindow>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/04/cfwindow-tag-how-to-use-cfwindow-in.html
Example 170

nested functions - how to use nested functions in coldfusion

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>nested functions - how to use nested functions in
coldfusion</title>
</head>

<body>
<h2 style="color:DodgerBlue; font-style:italic">coldfusion nested
functions example: how to use</h2>
<hr width="500" align="left" color="PowderBlue" />
<br />

<cfset Today=UCase(DateFormat(Now(),"dd-mmmm-yyyy"))>

<font style="font-weight:bold; color:SeaGreen; font-size:X-large;">ToDay


Is: </font>
<br />

<font style="color:DeepPink; font-weight:bold; font-size:large; font-


family:'Courier New', Courier, monospace;">
<cfoutput>#ToDay#</cfoutput>
</font>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/12/nested-functions-how-to-use-nested.html
Example 171

server variables - how to dump and get output server variables

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>server variables - how to dump and get output server
variables</title>
</head>

<body>
<h2 style="color:DodgerBlue; font-style:italic">coldfusion server
variables example: how to get output</h2>
<hr width="500" align="left" color="PowderBlue" />
<br />

<cfdump var="#server#">
<br />

<font style="font-weight:bold; color:SeaGreen; font-size:large;">example


server variable Output</font>
<br />

<font style="color:DeepPink; font-weight:bold; font-family:'Courier New',


Courier, monospace;">
PRODUCT VERSION[#server.ColdFusion.PRODUCTVERSION#]:
<cfoutput>#server.ColdFusion.PRODUCTVERSION#</cfoutput>
</font>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/12/server-variables-how-to-dump-and-get.html
Example 172

DataSource List - how to get coldfusion DataSource list


programmatically
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>DataSource List - how to get coldfusion DataSource list
programmatically</title>
</head>

<body>
<h2 style="color:Crimson; font-style:italic">DataSource example: how to
get DataSource list</h2>
<hr width="500" align="left" color="LightPink" />
<br />

<cfobject
action="create"
type="java"
class="coldfusion.server.ServiceFactory"
name="cfactory"
>
<cfset DSourceStruct=cfactory.getDataSourceService().getDataSources()>
<cfset DSourceList=StructKeyList(DSourceStruct,",")>

<table border="1" cellpadding="2" cellspacing="2" bordercolor="Pink"


bgcolor="DeepPink" width="350">
<tr style="color:Snow; font-weight:bold; font-size:large; font-
family:'Courier New', Courier, monospace;" height="35">
<td>
ColdFusion DataSource List
</td>
</tr>
<cfoutput>
<cfloop index="i" list="#DSourceList#">
<tr style="font-weight:bold; font-style:normal; color:Snow;">
<td bgcolor="HotPink">
#i#
</td>
</tr>
</cfloop>
</cfoutput>
</table>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/12/datasource-list-how-to-get-coldfusion.html
Example 173

coldfusion dynamic variables - how to create and use in


coldfusion
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>coldfusion dynamic variables - how to create and use in
coldfusion</title>
</head>

<body>
<h2 style="color:DarkBlue; font-style:italic">coldfusion dynamic
variables example: how to use</h2>
<hr width="500" align="left" color="LightBlue" />
<br />

<cfset ColorName="Crimson">
<cfset "#ColorName#"="Red type color">

<cfdump var="#Variables#">
<br />

<table border="0" cellpadding="2" cellspacing="2" bgcolor="DeepPink"


width="250">
<tr style="background-color:Crimson; color:Snow; font-size:large;">
<td>Variable</td>
<td>Output</td>
</tr>
<cfoutput>
<tr style="background-color:OrangeRed; color:Snow;">
<td>ColorName</td>
<td>#ColorName#</td>
</tr>
<tr style="background-color:OrangeRed; color:Snow;">
<td>Crimson</td>
<td>#Crimson#</td>
</tr>
</cfoutput>
</table>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/12/coldfusion-dynamic-variables-how-to.html
Example 174

coldfusion functions masks - how to use masks in coldfusion


functions
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>coldfusion functions masks - how to use masks in coldfusion
functions</title>
</head>

<body>
<h2 style="color:DarkBlue; font-style:italic">coldfusion functions masks
example: how to use</h2>
<hr width="450" align="left" color="LightBlue" />
<br />

<cfset Salary=1525>
<cfset SalaryWithMask=NumberFormat(Salary,"$")>
<cfset ToDay=DateFormat(Now())>
<cfset ToDayWithMask=DateFormat(Now(),"mmmm-dd-yyyy")>

<table border="0" cellpadding="2" cellspacing="2" bgcolor="DeepPink"


width="250">
<tr style="background-color:OrangeRed; color:Snow; font-size:large;">
<td>Variable=Value</td>
<td>Output</td>
</tr>
<cfoutput>
<tr style="background-color:HotPink; color:Snow; font-
family:'Courier New', Courier, monospace">
<td>Salary=1525</td>
<td>#Salary#</td>
</tr>
<tr style="background-color:HotPink; color:Snow; font-
family:'Courier New', Courier, monospace">
<td>SalaryWithMask=NumberFormat(Salary,"$")</td>
<td>#SalaryWithMask#</td>
</tr>
<tr style="background-color:HotPink; color:Snow; font-
family:'Courier New', Courier, monospace">
<td>ToDay=DateFormat(Now())</td>
<td>#ToDay#</td>
</tr>
<tr style="background-color:HotPink; color:Snow; font-
family:'Courier New', Courier, monospace">
<td>ToDayWithMask=DateFormat(Now(),"mmmm-dd-yyyy")</td>
<td>#ToDayWithMask#</td>
</tr>
</cfoutput>
</table>
</body>
</html>
http://coldfusion-example.blogspot.com/2009/12/coldfusion-functions-masks-how-to-use.html
Example 175

ColdFusion Variables are typeless - how to test variables


typeless feature
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ColdFusion Variables are typeless - how to test variables
typeless feature</title>
</head>

<body>
<h2 style="color:SeaGreen; font-style:italic">ColdFusion Variables are
typeless example: how to verify</h2>
<hr width="600" align="left" color="DarkSeaGreen" />
<br />

<cfset TestNumber=5>

<cfset TestString="20">
<cfset SampleMath=TestNumber*TestString>
<cfset SampleString="First Number: " & TestNumber & " Second Number: " &
TestString>

<table border="0" cellpadding="2" cellspacing="2" bgcolor="OrangeRed">


<tr style="background-color:Crimson; color:Snow; font-size:large;">
<td>Variable=Value</td>
<td>Output</td>
</tr>
<cfoutput>
<tr style="background-color:HotPink; color:Snow;">
<td>TestNumber=5</td>
<td>#TestNumber#</td>
</tr>
<tr style="background-color:HotPink; color:Snow;">
<td>TestString="20"</td>
<td>#TestString#</td>
</tr>
<tr style="background-color:HotPink; color:Snow;">
<td>SampleMath=TestNumber*TestString</td>
<td>#SampleMath#</td>
</tr>
<tr style="background-color:HotPink; color:Snow;">
<td>SampleString="First Number: " & TestNumber & " Second
Number: " & TestString</td>
<td>#SampleString#</td>
</tr>
</cfoutput>
</table>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/12/coldfusion-variables-are-typeless-how.html
Example 176

Application scopes query caching - how to cache query data in


Application scope
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Application scopes query caching - how to cache query data in
Application scope</title>
</head>

<body>
<h2 style="color:Crimson; font-style:italic">ColdFusion query caching
example: how to cache query in Application scope</h2>
<hr width="600" align="left" color="LightPink" />
<br />

<cfquery name="Application.Authors" datasource="cfbookclub" maxrows="2">


select AuthorID, FirstName, LastName from Authors
</cfquery>

<cfdump var="#Application#" label="Application Scopes">

</body>
</html>
http://coldfusion-example.blogspot.com/2009/12/application-scopes-query-caching-how-to.html
Example 177

Server scopes query caching - how to cache query data in


server scope
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Server scopes query caching - how to cache query data in
server scope</title>
</head>

<body>
<h2 style="color:DarkBlue; font-style:italic">ColdFusion query caching
example: how to cache query in server scope</h2>
<hr width="750" align="left" color="LightBlue" />
<br />

<cfset server.admin="cfsuman">

<cfquery name="server.Books" datasource="cfbookclub" maxrows="3">


select BookID, Title from Books
</cfquery>

<cfdump var="#server#" label="server scopes">


<br />

<table border="0" cellpadding="2" cellspacing="2" bgcolor="OrangeRed">


<tr style="background-color:DeepPink; color:Snow; font-weight:bold;">
<td>
Book ID
</td>
<td>
Title
</td>
</tr>
<cfoutput query="server.Books">
<tr style="color:Snow; background-color:HotPink; font-
family:'Courier New', Courier, monospace;">
<td>
#BookID#
</td>
<td>
#Title#
</td>
</tr>
</cfoutput>
</table>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/12/server-scopes-query-caching-how-to.html
Example 178

Session scopes query caching - how to cache query data in


session scope
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Session scopes query caching - how to cache query data in
session scope</title>
</head>

<body>
<h2 style="color:Crimson; font-style:italic">ColdFusion query caching
example: how to cache query in session scope</h2>
<hr width="600" align="left" color="LightPink" />
<br />

<!--at first enable session management in application.cfm file-->

<cfset Session.UserName="cfsuman">

<cfquery name="Session.Authors" datasource="cfbookclub" maxrows="2">


select AuthorID, FirstName, LastName from Authors
</cfquery>

<cfdump var="#Session#" label="Session">


<br />

<table border="0" cellpadding="2" cellspacing="2" bgcolor="OrangeRed">


<tr style="background-color:DeepPink; color:Snow; font-weight:bold;">
<td>
Author ID
</td>
<td>
First Name
</td>
<td>
Last Name
</td>
</tr>
<cfoutput query="Session.Authors">
<tr style="color:Snow; background-color:HotPink; font-
family:'Courier New', Courier, monospace;">
<td>
#AuthorID#
</td>
<td>
#FirstName#
</td>
<td>
#LastName#
</td>
</tr>
</cfoutput>
</table>

</body>
</html>
http://coldfusion-example.blogspot.com/2009/12/session-scopes-query-caching-how-to.html

You might also like