Programming instructions
96 Lesson 3 Creating a Main Application 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 Trip Detail page:
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 the 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.