ui.Dialog.validate

Checks form level validation rules.

Syntax

validate(
   formFieldList )
  RETURNS INTEGER
  1. formFieldList is a variable parameter list of strings (using [ ] notation), to define the fields to be checked. The [ ] square brackets are optional, if only one element is provided. See also Identifying fields in ui.Dialog methods.

Usage

Use the validate() method in order to execute NOT NULL, REQUIRED and INCLUDE validation rules defined in the form specification files.

The method takes a variable list parameter with the [ ] square brace notation, containing a comma-separated list of fields or screen records. The [ ] square brackets are optional, if only one element is to be validated:

DIALOG.validate("customer.cust_name")
DIALOG.validate("cust_rec.*")
DIALOG.validate( [ "cust_rec.*", "ord_rec.*" ] ) 

There are different notations to identify form fields in a dialog. For details, see Identifying fields in ui.Dialog methods.

The method returns zero if success, or the input error code of the first field which does not satisfy the validation rules.

Note: The current field is always checked, even if it is not part of the validation field list. This is mandatory, otherwise the current field may be left with invalid data.

If an error occurs, the validate() method automatically displays the corresponding error message, and registers the next field to jump to when the interactive instruction gets the control back.

The validate() method does not stop code execution if an error is detected. You must execute a CONTINUE DIALOG or CONTINUE INPUT instruction to cancel the code execution.

A typical usage is for a "save" action:
ON ACTION save 
   IF DIALOG.validate("cust_rec.*") < 0 THEN
      CONTINUE DIALOG
   END IF
   CALL customer_save()