Validation script for a new setting

When you add an additional setting you have the ability to create simple or complex validations for the setting using JavaScript. The JavaScript automatically sets up an XML variable named result, which has a child node named message. If the value of the result node is 0 (zero), the validation has succeeded. Any non-zero result is interpreted as a failure. When a validation fails, the contents of the message node display. The value of the setting being validated is set to a variable named value.

Example:

This example validates that the setting is a number between 1 and 10.

if ( value < 1 || value > 10 )
     {
        result.setValue( -1 );
        message.setValue(“The value must be between 1 and 10.”);
     }