System information

100 Chapter 9: Lesson 6: Creating a Main Application Page
Reviewing the code
The following table describes the navigation code for the Trip Detail page:
Exercise 2: Adding database maintenance buttons
The search and sequential navigation capabilities are features for locating Compass Travel trips.
After locating a trip, the trip coordinator must be able to modify or delete it. Additionally, when
viewing the detail for a trip, the trip coordinator must be allowed to add a new trip or use the
search facility. To enable trip coordinators to do this, you add the following buttons to the Trip
Detail page:
As described in “Exercise 1: Creating the main application page from the Trip Detail page
on page 98, it is important to pass the current record ID (
tripID) to the action page to build the
proper SQL statement to process the navigation button requests. It is also important to pass the
current record ID to the Maintenance Action page. Therefore, you use an HTML
input tag to
hide the current
recordID and post it to the maintenanceaction.cfm page.
To add maintenance buttons:
1.
Open the tripdetail.cfm file from the my_app subdirectory.
2.
Enter the following code immediately after the <cfoutput query="TripQuery"> tag:
<form action="maintenanceaction.cfm" method="post">
<input type="hidden" name="RecordID" value="#tripID#">
<input type="submit" name="btnAdd" value=" Add ">
<input type="submit" name="btnEdit" value=" Edit ">
<input type="submit" name="btnDelete" value="Delete">
<input type="submit" name="btnSearch" value="Search">
</form>
Note: The current trip record ID (
tripID) is in a hidden field in the form code. This field provides the
action page with current record ID that it must have in order to build the query to access the
appropriate record in the Trips database table.
3.
Save the file.
Code Explanation
<form action="navigationaction.cfm" method="post">
Form tag that identifies the
navigationaction.cfm file to handle
record navigation.
<INPUT type="hidden" name="RecordID"
value="#tripID#">
Hidden RecordID field with the value of
the current
tripID.
<input type="image" name="btnFirst" src="images/
first.gif">
<input type="image" name="btnPrev" src="images/
prev.gif">
<input type="image" name="btnNext" src="images/
next.gif">
<input type="image" name="btnLast" src="images/
last.gif">
Navigation buttons that are image type
HTML input tags.