<!--- This example shows the use of CFTREE, CFSELECT and CFGRID in a CFFORM.
The query takes a list of employees, and uses CFTREE and CFSELECT
to display the results of the query.  In addition, CFGRID is used
to show an alternate means of displaying the same data --->

<!--- set a default for the employeeNames variable --->
<CFPARAM name="employeeNames" default="">

<!--- if an employee name has been passed from the form,
set employeeNames variable to this value --->
<CFIF IsDefined("form.employeeNames") is not "False">
	<CFSET employeeNames = form.employeeNames>
</CFIF>

<!--- query the datasource to find the employee information--->
<CFQUERY NAME="GetEmployees" DATASOURCE="cfsnippets">
SELECT   Emp_ID, FirstName, LastName, EMail, Phone, Department
FROM     Employees Where 0=0 <CFIF employeeNames is not "">AND LastName = '#employeeNames#'</CFIF>
</CFQUERY>

<HTML>
<HEAD>
<TITLE>
CFSELECT Example
</TITLE>
</HEAD>

<BASEFONT FACE="Arial, Helvetica" SIZE=2>
<BODY  bgcolor="#FFFFD5">

<H3>CFSELECT Example</H3>

<!--- Use CFFORM when using other CFINPUT tools --->
<CFFORM ACTION="cfselect.cfm" METHOD="POST" ENABLECAB="Yes">

<!--- Use CFSELECT to present the contents of the query by column --->
<H3>CFSELECT Presentation of Data</H3>
<H4>Click on an employee's last name and hit "see information for
this employee" to see expanded information.</H4>
<CFSELECT NAME="EmployeeNames" MESSAGE="Select an Employee Name" SIZE="#getEmployees.recordcount#" QUERY="GetEmployees" VALUE="LastName" REQUIRED="No">
<OPTION value="">Select All
</CFSELECT>

<INPUT TYPE="Submit" NAME="" VALUE="see information for this employee">

<!--- showing the use of CFTREE --->

<!--- Use CFTREE for an expanded presentation of the data --->
<!--- Loop through the query to create each branch of the CFTREE --->
<H3>CFTREE Presentation of Data</H3>
<H4>Click on the folders to "drill down" and reveal information.</H4>
<P><CFTREE NAME="SeeEmployees" HEIGHT="150" WIDTH="240" FONT="Arial Narrow" BOLD="No" ITALIC="No" BORDER="Yes" HSCROLL="Yes" VSCROLL="Yes" REQUIRED="No" COMPLETEPATH="No" APPENDKEY="Yes" HIGHLIGHTHREF="Yes">
<CFLOOP QUERY="GetEmployees">
<CFTREEITEM VALUE="#Emp_ID#" PARENT="SeeEmployees" EXPAND="No">
<CFTREEITEM VALUE="#LastName#" DISPLAY="Name" PARENT="#Emp_ID#" QUERYASROOT="No" EXPAND="No">
	<CFTREEITEM VALUE="#LastName#, #FirstName#" PARENT="#LastName#" EXPAND="No" QUERYASROOT="No">
<CFTREEITEM VALUE="#Department#" DISPLAY="Department" PARENT="#Emp_ID#" QUERYASROOT="No" EXPAND="No">
	<CFTREEITEM VALUE="#Department#" PARENT="#Department#" EXPAND="No" QUERYASROOT="No">
<CFTREEITEM VALUE="#Phone#" DISPLAY="Phone" PARENT="#Emp_ID#" QUERYASROOT="No" EXPAND="No">
	<CFTREEITEM VALUE="#Phone#" PARENT="#Phone#" EXPAND="No" QUERYASROOT="No">
<CFTREEITEM VALUE="#Email#" DISPLAY="Email" PARENT="#Emp_ID#" QUERYASROOT="No" EXPAND="No">
	<CFTREEITEM VALUE="#Email#" PARENT="#Email#" EXPAND="No" QUERYASROOT="No">
</CFLOOP>
</CFTREE>

<!--- You can also use CFGRID for a more comprehensive, quicker
view at the data --->
<H3>CFGRID Presentation of Data</H3>

<CFGRID NAME="SampleGrid" WIDTH="600" QUERY="GetEmployees" INSERT="No" DELETE="No" SORT="No" FONT="Verdana" BOLD="No" ITALIC="No" APPENDKEY="No" HIGHLIGHTHREF="No" GRIDDATAALIGN="LEFT" GRIDLINES="Yes" ROWHEADERS="No" ROWHEADERALIGN="LEFT" ROWHEADERITALIC="No" ROWHEADERBOLD="No" COLHEADERS="Yes" COLHEADERALIGN="CENTER" COLHEADERITALIC="No" COLHEADERBOLD="No" BGCOLOR="Teal" SELECTMODE="BROWSE" PICTUREBAR="No">
<CFGRIDCOLUMN NAME="LastName" HEADER="Last Name" HEADERALIGN="LEFT" DATAALIGN="LEFT" BOLD="No" ITALIC="No" SELECT="Yes" DISPLAY="Yes" HEADERBOLD="No" HEADERITALIC="No">
<CFGRIDCOLUMN NAME="FirstName" HEADER="First Name" HEADERALIGN="LEFT" DATAALIGN="LEFT" FONTSIZE="2" BOLD="No" ITALIC="No" SELECT="No" DISPLAY="Yes" HEADERBOLD="No" HEADERITALIC="No">
<CFGRIDCOLUMN NAME="Email" HEADER="Email" HEADERALIGN="LEFT" DATAALIGN="LEFT" BOLD="No" ITALIC="No" SELECT="No" DISPLAY="Yes" HEADERBOLD="No" HEADERITALIC="No">
<CFGRIDCOLUMN NAME="Phone" HEADER="Phone" HEADERALIGN="LEFT" DATAALIGN="LEFT" BOLD="No" ITALIC="Yes" SELECT="No" DISPLAY="Yes" HEADERBOLD="No" HEADERITALIC="No">
<CFGRIDCOLUMN NAME="Department" HEADER="Department" HEADERALIGN="LEFT" DATAALIGN="LEFT" BOLD="Yes" ITALIC="No" SELECT="No" DISPLAY="Yes" HEADERBOLD="No" HEADERITALIC="No">
<CFGRIDCOLUMN NAME="Emp_ID" HEADER="ID" HEADERALIGN="LEFT" DATAALIGN="LEFT" WIDTH="40" BOLD="No" ITALIC="No" SELECT="No" DISPLAY="Yes" HEADERBOLD="No" HEADERITALIC="No">
</CFGRID>
</CFFORM>

</BODY>
</HTML>       
