Summary; In The Next Lesson - MACROMEDIA COLDFUSION MX 61-GETTING STARTED BUILDING COLDFUSION MX Getting Started

Building coldfusion mx applications
Table of Contents

Advertisement

To verify that the photo filename exists:
Open the tripeditaction.cfm in the my_app directory in your editor.
1
In the tripeditaction.cfm page, do the following:
2
Add logic to check that the user entered a valid photo filename by copying the code from
a
the photofilecheck.txt file in the solutions directory pasting it immediately following the
first <cfset isOk = "Yes"> statement.
Verify that code you copied in step a is pointing to the correct photolocation path. The path
b
is specified in the <cfset PhotoLocation = "C:..."> tag.
For example, depending on your web server configuration, the photolocation path might
be:
For MS Windows systems:
<cfset PhotoLocation
"C:\cfusionmx\wwwroot\cfdocs\getting_started\photos\">
or
<cfset PhotoLocation =
"C:\Inetpub\wwwroot\cfdocs\getting_started\photos\">
For Linux or Solaris systems:
<cfset PhotoLocation =
"/opt/cfusionmx/wwwroot/cfdocs/getting_started/photos/">
or
<cfset PhotoLocation =
"/<webserverdocroot>/cfdocs/getting_started/photos/">
Save the page and test it by opening the tripedit.cfm page in your browser.
3
Testing recommendations:
In the Trip Edit page, enter valid information in all the required fields but the Photo File
a
field.
In the Photo File field, enter nowhere.jpg and click Save.
b
The following error message appears: Trip photo does not exist.
To avoid the error, replace the invalid photo filename in the Trip Edit page with
c
somewhere.jpg and click Save.
The following message appears: Trip added.

Summary

As described in this lesson, ColdFusion offers several alternatives to validating data. If you are
familiar with standard page validation code, ColdFusion supports these development approaches.
However, ColdFusion form tags simplify data validation. Additionally, you can use JavaScript
with ColdFusion to execute client-side functions.

In the next lesson

Now that you are sure that your application can save valid data, in the next lesson, you will write
code to add trips to the database. Additionally, you will add logic to update existing trip data in
the Trips table.
108
Chapter 8: Lesson 4: Validating Data to Enforce Business Rules

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?

Questions and answers

This manual is also suitable for:

Coldfusion mx

Table of Contents