Validation Script

The final expression in the validation script must evaluate to true (if the data are valid), false (if the data are invalid), or an array of strings (if the data are invalid and the validation message contains substitution variables).

In the Edit Validation Script dialog, you can edit the script that determines whether the data submitted are valid, or you can modify the error message that appears when users submit invalid data.

You can use the notation this in your script to refer to the control or pane during a given validation invocation. A validation script, for instance, might contain a statement such as:

this.getValue() == "New York";

You can also use the context object provided while executing the validation to retrieve the value of the given control or pane:

context.value == "New York";

You can refer to any control by using the “control.” notation, or to a pane using "pane." notation. To refer to the value of a control, use the latter notation in conjunction with the Control.getValue() method:

control.city_name.getValue() == "New York";
Note: Validation scripts must have no side effects. Do not set the value of controls nor make any modifications to the form model from within a validation script.