About ColdFusion validation
Data
validation lets you control data that is entered into an application
by ensuring that the data conforms to specific type or formatting
rules. Validation techniques have the following features:
They let you provide feedback to users so that they can
immediately correct information they provide. For example, a form
can provide immediate feedback when a user enters a name in a telephone
number field, or the form could force the user to enter the number
in the correct format.
They help prevent application errors that can arise when
processing invalid data. For example, a validation test can prevent
a variable that is used in a calculation from having nonnumeric
data.
They can help enhance security by preventing malicious users
from providing data that takes advantage of system security weaknesses,
such as buffer overrun attacks.
ColdFusion provides several techniques to ensure that data is
valid. These include techniques for validating form data and for
validating ColdFusion variables. They also include techniques for
validating form data before the user submits it to ColdFusion, or
on the ColdFusion server.
When you design data validation you consider the following factors:
- The validation technique
- Whether to validate on the client’s browser or on the server,
and the specific server- or client-side validation technique, such
as whether to validate when a field loses focus or when the user
submits the form.
- The validation type
- The specific method that you use to validate the data, including
the rules that you apply to test the data validity, such as testing
for a valid telephone number.