The ACCEPT DIALOG statement validates all input
fields bound to the DIALOG instruction and leaves
the block if no error is raised. Control blocks such as ON
CHANGE, AFTER FIELD, AFTER ROW, AFTER
INPUT/DISPLAY/CONSTRUCT will be executed according to the
dialog structure. The statements appearing after the ACCEPT
DIALOG will be skipped.
You typically code an
ACCEPT DIALOG in an
ON
ACTION accept block:
ON ACTION accept
ACCEPT DIALOG
Note that any usage of ACCEPT DIALOG outside an ON
ACTION accept block is not intended and behaves undocumented.
Input field validation is a process that does several successive
validation tasks:
- The current field value is checked, according to the program variable
data type (for example, the user must input a valid date in a DATE
field).
- 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.
- 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.
- 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.