In addition to native ColdFusion input validation using the validate
attribute of the cfinput
and cftextinput
tags, the following tags support the onvalidate
attribute, which lets you specify a JavaScript function to handle your cfform
input validation:
ColdFusion passes the following arguments to the JavaScript function you specify in the onvalidate
attribute:
For example, if you code the cfinput
tag as the following:
<cfinput type="text" ... <!--- Do not include () in JavaScript function name ---> onvalidate="handleValidation" ... >
You define the JavaScript function as the following:
<script> <!-- function handleValidation(form_object, input_object, object_value) { ... } //--> </script>