Programming instructions
90 Lesson 3 Creating a Main Application Page
3 In the Trip Location drop-down list box, select Begins With and type the value C in 
the trip location text box then click Search. 
The Trip Search Results page displays a hyperlink for each trip name listed, as the 
following figure shows:
4 To view the Trip Detail page for a trip, click on the trip name.
You might notice that the dates and prices in both the Trip Detail and Trip Search 
Results pages are unformatted. You will improve the appearance of the application in the 
next exercise.
Enhancing the look of the search results and detail pages
The Trip Maintenance search now provides a useful drill-down mechanism for locating 
trips. While this application is functionally sound, the appearance of the dates and dollar 
amounts could be improved. 
ColdFusion provides several functions to improve the application appearance. The 
DateFormat and DollarFormat functions format dates and currency variables. 
ColdFusion provides. 
Another part of the application that could be improved is the Trip Search Results table. 
In a large list, it is sometimes difficult to correctly read the contents of a row in the 
middle of the table because it is sandwiched between two other rows. To avoid mistakes 
in reading the table, it would be helpful to alternate the background color of each row in 
the table.
The HTML table row 
<tr> tag has a bgcolor attribute to change the background color 
for a given row. To highlight every other row, the background color could be changed 
alternatively to yellow or white. To change the background color for each row, you must 
determine whether the row is an odd or even row. Therefore, you must obtain the 
sequence number of the current row and test if it is evenly divisible by 2. 
As described in Chapter 2, ColdFusion offers a modulus function (
MOD) that returns the 
remainder (modulus) after a number is divided by a divisor; for example,
10 MOD 3 is 1. 
If the 
MOD function returns a value greater than 0, a cfif test of its result evaluates to 
True. If the MOD function returns 0, the cfif check fails. 










