MACROMEDIA COLDFUSION MX 61-CFML Informacje Techniczne Strona 112

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 152
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 111
112 Chapter 10: Lesson 7: Validating Data to Enforce Business Rules
Note: You have already entered validation code for business rule 1. Validation code for business rule
10 is described in more detail later in this lesson.
Rule Description Validation code
2 All trips must be accompanied
by a full description.
<!--- Trip description is required. --->
<cfif Form.tripDescription EQ "">
<cfset IsOk = "No">
<cfoutput>
Trip description cannot be blank.
</cfoutput>
</cfif>
3 Each trip must be categorized
by event type. Only valid event
types (1-surfing, 2-mountain
climbing, and so on) are
permissible.
Because event type 1 (surfing) is selected by default, there is
always a value for event type.
4 Trip locations are required.
<!--- Trip location is required. --->
<cfif Form.tripLocation EQ "">
<cfset IsOk = "No">
<cfoutput>
Trip location cannot be blank.
</cfoutput>
</cfif>
5 The maximum number of
people permitted on the trip
must be specified.
<!--- Number of people is required and must be
numeric. --->
<cfif Form.numberPeople EQ "" or
IsNumeric(Form.numberPeople) EQ False>
<cfset IsOk = "No">
<cfoutput>
The number of people must be a number and
cannot be blank.
</cfoutput>
</cfif>
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.
<cfif form.departureDate GT form.returnDate>
<cfset isOk = "No">
<cfoutput>
Departure date cannot precede return date.
Please re-enter.
</cfoutput>
</cfif>
Przeglądanie stron 111
1 2 ... 107 108 109 110 111 112 113 114 115 116 117 ... 151 152

Komentarze do niniejszej Instrukcji

Brak uwag