Data Validation in a Form
TIBCO Forms supports runtime validation of data as the user fills up the forms. You can configure validations for the fields defined on the form. You can configure the validations to occur either when the user changes a field value, or when the user submits the form.
Validations help users to specify correct data, thereby enhancing the overall experience. On the server side, the submitted data are validated against the restrictions specified in the business object models used within the form.
You can write validation scripts for each control as well as each pane on a form. Validation scripts usually run when users update data or submit the form. The scripts need to be written to explicitly return a Boolean or an Array.
- If the returned value for all validation scripts on the form is true, the form data are valid.
- If the returned value for one or more validation scripts is false, the validation error messages are displayed on the form in a special pane called a Messages pane. Users can click the error message to navigate to the first instance of the error in the form.
- If the validation expression evaluates to an array of strings, it indicates a failed validation. In this case, the Messages pane substitutes each indexed parameter marker in the validation message template with the corresponding array element.
The Messages pane displays the validation messages. You can specify a validation message either using a key reference from the External Resources of a *.properties file or as a Custom Message.
By default, the Messages pane opens at the bottom of the form when a validation fails. By manually adding a Messages pane to the form, you can configure the font and layout properties of the pane, and place it anywhere other than the default position.