ui.Dialog.validate

Check form level validation rules.

Syntax

validate(
   field-list STRING )
  RETURNING result INTEGER
  1. field-list is the string with the list of field specification.

Usage

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

Can the method by passing a list of fields or screen records as parameter.

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

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.*") < 0 THEN
      CONTINUE DIALOG
   END IF
   CALL customer_save()

For more details about field name specification, see Identifying fields in dialog methods.