Adding Scripting to Rules

The <actf:scripts> tag is used to define scripts in a validation document. These scripts serve as support for any script code that might occur within the text content of a subsequent element. Typically, in a validation document, scripts are used to perform more specialized validations on particular components or properties of components. The text content of any element specifying a property to be tested can include script code and that property is assumed to pass if, and only if, the script code returns true (or the scripting language's equivalent). The identifiers propValue and thisComponent are available within script code to refer to the value of the current property being tested and to the component being processed in the hierarchy, respectively.

Script tests may also be performed on every instance of a given class of GUI elements. To incorporate such a test into a validation document, use a <actf:scripttest> element as a child element of an element that represents the class to be tested. (This makes the <actf:scripttest> element a grandchild of the <actf:ruleset> element.) The text content of the <actf:scripttest> element can then contain a script that returns a boolean value and may also refer to the special thisComponent identifier. Multiple <actf:scriptest> elements may occur as children of an element naming a class to be validated.