Exercise 3: About Data Validation - MACROMEDIA COLFUSION MX 7-GETTING STARTED BUILDING COLDFUSION MX Getting Started

Building coldfusion mx applications
Table of Contents

Advertisement

Exercise 3: About data validation

To ensure that the data entered in the trip edit form is valid, Compass Travel has identified a set of
business rules for capturing and editing trip information. A fundamental concern is ensuring that
the captured data is suitable for the column definitions in the Trips table. This type of validation
on a single field is often referred to as a single-field edit.
Compass Travel has other operating policies that involve evaluating the values from more than
one field. These validations, referred to as cross-field edits, are usually more difficult to program.
To ensure that new trips are uniformly captured, Compass Travel has published cross-field
validations and single-field edits in its Compass Travel business rules.
The following table lists the Compass Travel business rules for capturing and editing trip
information. This table identifies which rules require single-field or cross-field editing.
Compass Travel new trip policy
1
All trips must be named.
2
All trips must be accompanied by a full description.
3
Each trip must be categorized by event type. Only valid event types (1-surfing, 2-
mountain climbing, and so on) are permissible.
4
Trip locations are required.
5
The maximum number of people permitted on the trip must be specified.
6
The trip departure and return dates must be specified for each trip.
All trip dates must be valid future dates. Departure date must precede return date.
7
The trip's price and base cost are required. Both values are positive numeric
values. The trip price must have at least a 20% markup over base cost.
8
Any trip priced over $750 requires a deposit.
9
A trip leader must be identified.
10
A photo must accompany all new trips. The photo image file must reside in the
images directory of the Compass Travel website.
ColdFusion provides numerous ways to validate data. For more information, see Chapter 28,
"Validating Data" in ColdFusion MX Developer's Guide. In this lesson, you use special tags to
simplify the process of enforcing business rules. Using ColdFusion, it is possible to enforce
business rules in several places. For example, you can enforce some validation edits on the client.
You can enforce other validation edits on the server after the data entry form is submitted. You
will explore these options in the following exercises.
108
Chapter 10: Lesson 7: Validating Data to Enforce Business Rules
Edit type
Single-field
Single-field
Single-field
Single-field
Single-field
Single-field
Cross-field
Cross-field
Cross-field
Single-field
Single-field

Advertisement

Table of Contents
loading

This manual is also suitable for:

Colfusion mx 7 - installing and using coldfusion mx

Table of Contents