Reviewing the code
The following table describes the highlighted code and its function:
Code
<script>
<!--
function testbox(form) {
Ctrl = Form.inputbox1;
if (Ctrl.value == "" ||
Ctrl.value.indexOf ('@', 1) == -1 ||
Ctrl.value.indexOf ('.', 3) == -1)
{
return (false);
}
else
{
return (true);
}
}
//-->
</script>
onvalidate="testbox"
message="Sorry, your entry is not a valid
email address."
616
Chapter 27: Building Dynamic Forms
Description
JavaScript code that tests for valid entry in
the text box. The if statement checks to
making sure that the field is not empty and
contains an at sign (@) that at least the
second character and a period (.) that is at
least the fourth character.
Calls the JavaScript testbox function to
validate entries in this control.
Displays a message if the validation
function returns a false value.
Need help?
Do you have a question about the COLDFUSION MX 61-DEVELOPING COLDFUSION MX and is the answer not in the manual?
Questions and answers