User Guide
Enhancing the Trip Maintenance application 91
Reviewing the code
The following table describes the navigation code in the Trip Detail page:
Adding database maintenance buttons
The search and sequential navigation capabilities are features for locating Compass Travel trips.
After the trip coordinator locates a trip, they must be able to modify or delete the trip.
Additionally, when viewing the detail for a trip, they must be allowed to add a new trip or use the
search facility. To enable trip coordinators to do this, you will add the following buttons to the
Tr i p D e t a i l p a g e :
As described earlier, 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 will use an HTML
input tag to hide the current recordID and post it to the maintenanceaction.cfm page.
Exercise: add Maintenance Buttons to Trip Detail Page
Follow these steps to add the database maintenance buttons to the Trip Detail page.
To add maintenance buttons:
1 In your editor, open tripdetail.cfm from my_app subdirectory.
2 Enter the following code immediately after the <cfoutput query="TripQuery"> tag in the
tripdetail.cfm file:
<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.
Code Explanation
<form action="navigationaction.cfm" method="post">
Form tag identifying
navigationaction.cfm 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 are image type
HTML input tags.