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.
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
, AFTER DISPLAY
,
AFTER CONSTRUCT
control blocks will be executed when ACCEPT DIALOG
is performed.
The statements appearing after the ACCEPT DIALOG
instruction will be
skipped.
ACCEPT DIALOG
in an ON
ACTION accept
block:ON ACTION accept ACCEPT DIALOG
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:
- 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).
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 theNOT 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 aDISPLAY TO / BY NAME
orDIALOG.setFieldTouched()
call. If the field was not modified during the dialog, theREQUIRED
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.