validations |
Top Previous Next |
validationobj=new("validations")
The validations object is designed to run validations against a text value. Both standard and custom validations can be defined in the Image Manager's Custom Code window. The goal of each validation is to analyze a text value and set an errmsg$ variable if there is a problem with the value. The error message serves two purposes: to indicate the validity of the value, and to provide an information message to the user if the value is invalid.
Validation definitions are found in the im/validations.ini and im/validations.custom.ini files. Each validation is in a section, headed by the name in brackets. Each section contains a description= line, an optional parameters list, and an optional types list. The types list contains a comma-separated list of field types this validation can apply to, to provide context when looking up validations in job design. Types can include zone types ocr, bcd, grid, col, and field types text, note, number, date, list, and lookup. A validation can be run by code regardless of the types= list. The balance of the validation section is code designed to set errmsg$ to some value if the value supplied is invalid.
Validations can use parameters, passed into the running code as part of the name or as an array. Parameters can be passed to validations explicitly in an associative array param$[all] (i.e. p$["Val1"]="Value 1", passed as p$[all]), or via a syntax convention in the name (i.e. verifyitem(Val1="Value 1",Val2="Value 2") - note quotes are optional if commas are not in values). If a named value is passed both via parenthesized argument and parameter array, the parameter array value is used.
If a doc object is present, it is possible for a validation run to update document properties and fields via that object.
Image Manager jobs use validations in various places, where the design calls for it. Custom code can also use validations, as the validations object is available to any code the UnForm server runs.
Properties
Methods
|