Programming instructions

94 Lesson 3 Creating a Main Application Page
Adding navigation buttons to browse database
The drill-down search function developed in the last exercise is very useful when the user
knows some search criteria to enter. Unfortunately, however, flipping back and forth
between the results page and the detail page to navigate through a record set can be
tedious. Moreover, on occasion the trip coordinator might want to browse the Trips
database just to check for anomalies or to become familiar with its contents. In these
cases, the user does not know the criteria to search for in advance.
For example, an anomaly may exist on any trip record, the trip coordinator would have
no idea what search criteria to specify on the search form to find these problem records.
To solve this problem, the browse function gives the coordinator the ability to navigate
sequentially through the trips table using the single record trips display. The following
figure shows the navigation buttons. The label under each button describes which row to
display relative to the currently displayed row:
Exercise: adding navigation buttons to the Trip Detail page
In this exercise, you use the HTML
form and input tags to add the navigational buttons
to the Trips Detail page.
To add navigation:
1 Open the tripdetail.cfm in the my_app directory in your editor.
2 To implement the trip navigation buttons, insert the following code between the
</table> and</cfoutput> tags in the tripdetail.cfm file:
<form action="navigationaction.cfm" method="post">
<input type="hidden" name="RecordID" value="#tripID#">
<!--- graphical navigation buttons --->
<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">
</form>
Note: Notice that the current trip record ID (tripID) is hidden within the form code.
This is desirable because the action page must have the current record ID in order to
build the query that navigates to the appropriate record in the trips database table.