Enhancing The Look Of The Search Results And Detail Pages - MACROMEDIA COLDFUSION MX 61-GETTING STARTED BUILDING COLDFUSION MX Getting Started

Building coldfusion mx applications
Table of Contents

Advertisement

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
and
DollarFormat
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
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, "CFML Basics," on page
(
) that returns the remainder (modulus) after a number is divided by a divisor; for example,
MOD
is 1.
MOD 3
If the
function returns a value greater than 0, a
MOD
function returns 0, the
MOD
The following example uses the
<cfoutput query="tripResult">
<cfif CurrentRow Mod 2>
<cfset BackColor="White">
<cfelse>
<cfset BackColor="Yellow">
</cfif>
<tr bgcolor= "#BackColor#">
Notice that the
MOD
not defined anywhere in tripsearchresult.cfm. The
that ColdFusion automatically exposes that provide information about the query. These variables
are often called query variables.
Query variables
In addition to using the
use it to return information about a query. To do this, the
providing information in query variables as described in the following table:
Variable Name
query_name.recordCount
query_name.currentRow
query_name.columnList
86
Chapter 7: Lesson 3: Creating a Main Application Page
functions format dates and currency variables.
tag has a
<tr>
bgcolor
check evaluates to
cfif
function to alternate the background color of table rows:
MOD
function uses a variable called
tag to return data from a ColdFusion data source, you also can
cfquery
Description
The number of records returned by the query.
The current row of the query being processed by cfoutput.
A comma-delimited list of the query columns.
attribute to change the background color for a
15, ColdFusion offers a modulus function
test of its result evaluates to True. If the
cfif
.
False
. Notice also that
CurrentRow
variable is one of a few variables
CurrentRow
tag creates a query object,
cfquery
DateFormat
10
is
CurrentRow

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION MX 61-GETTING STARTED BUILDING COLDFUSION MX and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Coldfusion mx

Table of Contents