Exercise 3: Constructing the initial Trip Search Results page
79
Exercise 3: Constructing the initial Trip Search Results page
After the user enters the search criteria and submits the form, the results are posted to the Trip
Search Results page, as the following figure shows:
The logic contained in the search results page, also known as the action page, invokes the CFC
method that builds the SQL SELECT statement contained in a
cfquery
tag by using
ColdFusion string manipulation. The action page displays the result using the
cfoutput
tag.
To create the Trip Search Results page:
1.
Create a blank document and save it as tripsearchresult.cfm in the my_app directory.
Note:
If you are using Dreamweaver, select Dynamic page in the Category list, and ColdFusion in
the Dynamic Page list.
2.
Enter the following code, or do the steps in the
“Let Dreamweaver do it”
section.
<cfinvoke
component="cfdocs.getting_started.my_app.components.gettrips"
method="getTripsFromForm"
returnvariable="TripResult">
</cfinvoke>
3.
Enter or copy and paste the following code after the closing
cfinvoke
tag:
<html>
<head>
<title>Trip Maintenance - Search Results</title>
</head>
<body>
<img src="images/tripsearchresults.gif">
<table border="0" cellpadding="3" cellspacing="0">
<tr bgcolor="Gray">
<td>Trip Name
</td>
<td>Location
</td>
<td>Departure Date
</td>
<td>Return Date
</td>
<td>Price
Summary of Contents for COLFUSION MX 7-GETTING STARTED BUILDING COLDFUSION...
Page 1: ...COLDFUSION MX7 Getting Started Building ColdFusion MX Applications...
Page 6: ...6 Contents...
Page 10: ......
Page 14: ...14 Chapter 1 Introducing ColdFusion MX...
Page 38: ...38 Chapter 3 Database Fundamentals...
Page 40: ......
Page 58: ...58 Chapter 5 Lesson 2 Configuring Your Development Environment...
Page 70: ...70 Chapter 6 Lesson 3 Retrieving Data...
Page 84: ...84 Chapter 7 Lesson 4 Building Dynamic Queries...
Page 96: ...96 Chapter 8 Lesson 5 Creating a Trip Detail Page...
Page 102: ...102 Chapter 9 Lesson 6 Creating a Main Application Page...