User Guide
146 Chapter 9 Building Dynamic Forms
Reviewing the code
The following table describes the highlight code and its function:
See the following Web site for information on JavaScript validation scripts: http://
www.dannyg.com/javascript.
Code Description
<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>
JavaScript code to test 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.
onvalidate="testbox"
Calls the JavaScript testbox
function to validate entries in this
control.
message="Sorry, your entry is not a valid
email address."
Message to display if the
validation function returns a
false value.