You already created a search capability when you created the tripsearchform.cfm page in Lesson 4: Building Dynamic Queries. When the user clicks the Search button, you want to navigate to the tripsearchform.cfm page. You use the cflocation tag to do so.
<cfif IsDefined("Form.btnSearch")>
<!--- Code to execute if the user clicked Search. --->
<cflocation url="tripsearchform.cfm">
<cfelseif IsDefined("Form.btnDelete")>
<!--- Code to execute if the user clicked Delete. --->
<cfelseif IsDefined("Form.btnEdit")>
<!--- Code to execute if the user clicked Edit. --->
<cfelseif IsDefined("Form.btnAdd")>
<!--- Code to execute if the user clicked Add. --->
</cfif>
The following table describes the code that executes when the user clicks the Search button:
| Code | Explanation |
|---|---|
<cfif IsDefined("Form.btnSearch")>
<cflocation url="tripsearchform.cfm">
|
If the Form.btnSearch variable exists because the user clicked the Search button, go to the page tripsearchform.cfm. |
ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | KnowledgeBase | Bug Reporting
Version 7