System information

Exercise 5: Validating data on the client using ColdFusion form tags 117
Tip: For additional help, review the completed code in the ttripedit_lesson7_ex5.cfm file within the
solutions directory. For more details about using ColdFusion form tags and their attributes, see
ColdFusion MX Developer’s Guide.
Note: The client-side validation code that you added to the tripedit.cfm page does not validate the
cross-field rules.
5 The maximum number of
people permitted on the
trip must be specified.
<cfinput name="numberPeople"
size="6"
required="Yes"
validate="integer"
message="The number of people field must be
a number and cannot be blank.">
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.
<cfinput name="departureDate"
size="10"
required="Yes"
validate="date"
message="Departure date must be a valid date.">
<cfinput name="returnDate"
size="10"
required="Yes"
validate="date"
message="Return date must be a valid 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.
<cfinput name="price"
size="10"
required="Yes"
validate="integer"
message="Price is required and must be numeric.">
<cfinput name="baseCost"
size="10"
required="Yes"
validate="integer"
message="Base cost is required and must be numeric.">
8 Any trip priced over $750
requires a deposit.
<cfinput name="depositRequired"
type="checkbox"
value="Yes" >
9 A trip leader must be
identified.
<cfinput name="tripLeader"
maxlength="50" size="50"
required="Yes"
message="A trip leader must be specified.">
10 A photo must accompany
all new trips.
<cfinput name="photo"
maxlength="50" size="50"
required="Yes"
message="Valid photo file name must be specified.">
Rule Description Validation code