System information

104 Chapter 10: Lesson 7: Validating Data to Enforce Business Rules
Exercise 1: Using an HTML form to collect data
In this exercise, you develop the Trip Edit page, which provides a data entry form that is used to
add new trips and edit existing trips. You validate the data entered against Compass Travel
business rules. The fields required to capture trip information are the same as those on the Trip
Detail page that you used to display trip information in “Lesson 6: Creating a Main Application
Page” on page 97. The following figure shows the Trip Edit page:
The page appears when the user clicks the Add or Edit button on the main Trip Maintenance
application page (tripdetail.cfm).
To create the Trip Edit data collection form:
1.
Create a blank file.
2.
Enter or copy and paste the following code into the file:
<html>
<head><title>Compass Travel Trip Maintenance</title></head>
<body>
<form action="tripeditaction.cfm" method="post">
<!--- Field: Trip Maintenance Image --->
<IMG src="images/tripmaintenance.gif">
<P>
<table>
<!--- Field: tripName --->
<TR>
<TD valign="top"> Trip Name </TD>
<TD><INPUT type="text" name=tripName size="50"></TD>
</TR>
<!--- Field: eventType --->
<tr>
<td valign="top">Type of Event</td>