Input Validation With Javascript; Handling Failed Validation; Example: Validating An E-Mail Address - MACROMEDIA COLDFUSION 5-DEVELOPING Develop Manual

Table of Contents

Advertisement

144

Input Validation with JavaScript

In addition to native ColdFusion input validation using the
cfinput
which allows you to specify a JavaScript function to handle your
validation:
ColdFusion passes the following JavaScript objects to the JavaScript function you
specify in the

Handling failed validation

The
validation fails. For example, if you use the
JavaScript function to handle input validation, you can also use the
attribute to specify a JavaScript function to handle a failed validation (that is, when
onvalidate
also use the
errors. The following
ColdFusion passes the following JavaScript objects to the function in the
attribute:

Example: validating an e-mail address

The following example validates an e-mail entry. If the string is invalid it displays a
message box. If the address is valid it redisplays the page.
and
cftextinput
cfgrid
cfinput
cfslider
cftextinput
cftree
onvalidate
form_object (the form)
input_object (the tag whose value is being validated)
object_value (the value to validate)
attribute allows you to specify a JavaScript function to execute if a
onerror
returns a false value). If you are using the
attribute to specify a JavaScript function handle validation
onerror
cfform
cfgrid
cfinput
cfselect
cfslider
cftextinput
cftree
form_object
input_object
object_value
error message text
tags, the following tags support the
attribute:
onvalidate
tags support the
onerror
Chapter 9 Building Dynamic Forms
attribute of the
validate
onvalidate
cfform
attribute to specify a
onerror
attribute you can
validate
attribute:
attribute,
input
onerror

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 5

Table of Contents