Form-level validation rules can be defined for each field with
form specification attributes such       as NOT NULL, REQUIRED and INCLUDE.
These       attributes are part of the business rules of the application
and must be checked before saving       data into the database.
Implicit validation rule checking
 The DIALOG instruction automatically executes
form-level validation rules in the following cases:
 
- The NOT NULL attribute is satisfied if a value
is in the field. NOT             NULL is checked: 
- when the user moves to a different row in a list controlled by
an INPUT                 ARRAY; However, if the row
is temporary and none of the fields is touched,               the
attribute is ignored.
 
- when focus leaves the sub-dialog controlling the field;
 
- when NEXT FIELD gives the focus to a field in
a different               sub-dialog than the current sub-dialog.
 
- when the DIALOG instruction ends with ACCEPT
                DIALOG.
 
 
- The REQUIRED attribute is satisfied if the field
modification flag is true, if           a DEFAULT value
is defined, or if the WITHOUT DEFAULTS          
option is used. REQUIRED is checked: 
- when the user moves to a different row in a list controlled by
an INPUT                 ARRAY; However, if the row
is temporary and none of the fields is touched,               the
attribute is ignored.
 
- when focus leaves the sub-dialog controlling the field;
 
- when NEXT FIELD gives the focus to a field in
a different               sub-dialog than the current sub-dialog.
 
- when the DIALOG instruction ends with ACCEPT
                DIALOG.
 
 
- The INCLUDE attribute is satisfied if the value
is in the list defined by the           attribute. INCLUDE is
checked when the target program variable must be           assigned.
This happens: 
- when UNBUFFERED mode is used, focus is in the
field, and an action               is invoked;
 
- when the focus leaves the field;
 
- when the user moves to a different row in a list controlled by
an INPUT                 ARRAY; However, if the row
is temporary and none of the fields is touched,               the
attribute is ignored.
 
- when focus leaves the sub-dialog controlling the field;
 
- when NEXT FIELD gives the focus to a field in
a different               sub-dialog than the current sub-dialog.
 
- when the DIALOG instruction ends with ACCEPT
                DIALOG.
 
 
 Automatic validation occurs when the focus leaves a sub-dialog
of the DIALOG         instruction.
 
Performing validation rules explicitly 
   The DIALOG instruction
can be used as in singular interactive instructions,         with
the typical OK / Cancel buttons (i.e. accept / cancel actions) to
finish the         instruction. This lets the user input or modify
one record at a time, and program flow must         reenter theDIALOG instruction
to edit or create another record. To         implement this, you can
use the default behavior of the DIALOG instruction,
        and have it execute the form-level validation rules automatically
when focus is lost for a         sub-dialog or when leaving the dialog
with ACCEPT DIALOG (raised by the OK         button).
However, you may want to stay in theDIALOG instruction
and let the         user input / modify multiple records. In this
case, you need a way to execute the form-level         validation
rules defined for each field, before saving the data to the database.
Form-level         validation rules are defined by the NOT
NULL , REQUIRED         and INCLUDE attributes.
 
 To validate a subset of fields controlled by the 
DIALOG instruction,
use the           
ui.Dialog.validate("field-list") method,
as shown in this         example:
   ON ACTION save 
      IF DIALOG.validate("cust.*") < 0 THEN
        CONTINUE DIALOG
      END IF
      CALL customer_save()
 
This method automatically
displays an error message and registers the next field in case of
error. It is mandatory to execute a CONTINUE DIALOG instruction
if the function returns an error.