ACCEPT DIALOG instruction

The ACCEPT DIALOG statement validates all input fields bound to the DIALOG instruction and leaves the block if no error is raised.

Note: When used in a declarative DIALOG block, the ACCEPT DIALOG instruction does only make sense when the declarative dialog block is included in a procedural dialog block with the SUBDIALOG clause.

When defined in the dialog block, ON CHANGE, AFTER FIELD, AFTER ROW, AFTER INPUT/DISPLAY/CONSTRUCT control blocks will be executed when ACCEPT DIALOG is performed.

The statements appearing after the ACCEPT DIALOG instruction will be skipped.

You typically code an ACCEPT DIALOG in an ON ACTION accept block:
ON ACTION accept ACCEPT DIALOG
Important: Any usage of ACCEPT DIALOG outside an ON ACTION accept block is not intended and its behavior is undefined.

Input field validation is a process that does several successive validation tasks:

  1. The current field value is checked, depending on the variable data type (for example, the user must input a valid date in a DATE field).
  2. NOT NULL field attributes are checked for all input fields. This attribute forces the field to have a value set by program or entered by the user. If the field contains no value, the constraint is not satisfied. Input values are right-trimmed, so if the user inputs only spaces, this corresponds to a NULL value which does not fulfill the NOT NULL constraint.
  3. REQUIRED field attributes are checked for all input fields. This attribute forces the field to have a default value, or to be modified by the user or by program with a DISPLAY TO / BY NAME or DIALOG.setFieldTouched() call. If the field was not modified during the dialog, the REQUIRED constraint is not satisfied.
  4. INCLUDE field attributes are checked for all input fields. This attribute forces the field to contain a value that is listed in the include list. If the field contains a value that is not in the list, the constraint is not satisfied.

If a field does not satisfy one of these constraints, dialog termination is canceled, an error message is displayed, and the focus goes to the first field causing a problem.

After input field validation has succeeded, different types of control blocks will be executed, such as AFTER FIELD, AFTER ROW, AFTER INPUT and AFTER DIALOG.

In order to validate some parts of the dialog without leaving the block, use the DIALOG.validate() method.