Defining Cross-field Validation using XUI Editor

Overview

Cross-field Validation function is used to validate multiple fields in a form if their values are correlative. Submit type buttons in the form will be disabled until all the defined cross-field validations for the form are valid. For example, on most user account register forms, there are two password input fields. In order to avoid user inputting wrong password accidentally, these two fields are required to have the same value before the form can be submitted.

When any field in the form is changed (lost focus), the form would invoke the validation. When a cross-field validation rule is not valid, and there is no single-field validation message need to be shown, the hint message of the invalid cross-field validation rule will be shown.

If a form has multiple cross-field validation rules, and more than one rules are not valid, only one hint message of invalid rule will be selected and shown on the form. The message of invalid rules is selected according to:

  1. If the last changed field is belonged to a cross-field validation rule, and all other fields in the rule have their values.
  2. If no rule can be found in 1, then choose the first invalid rule according to definition sequence.
About this task
XUI editor enables you to define the condition of how multiple correlative fields in a cross-field validation are valid or not valid, and the hint message to be shown if values of correlative fields are not valid.
Note: This validation is executed on browser side, for cross validation on server side, please refer to Performing cross-field validation
Procedure
To define a cross-field validation, do the following steps:
  1. In the Project Explorer View, open a XUI file, and then select a form which you want to define cross-field validation.
  2. In the Properties view for the selected form, choose xValidation tab. Click the Add icon + to add a new xValidation rule.
  3. Select Basic tab in Details section to input basic information. Input the name of this validation in Name field. Input the hint message which will be shown when the values of correlative fields are not valid in Hint field. Hint message supports NLS, you can select NLS element by clicking Browse button. Choose to define either invalid condition or valid condition by clicking the "Invalid condition" checkbox.
  4. Select Condition tab in Details section to define condition of this validation. You can either choose Widget Function, Widget Property, Expression or Global Function to define the condition of this cross-field validation, and then click Apply Value to confirm.