In a singular INPUT, INPUT ARRAY instruction, or when used as parallel dialog, the BEFORE INPUT is only executed once when the dialog is started.
The BEFORE INPUT block is executed once at dialog startup, before the runtime system gives control to the user. This block can be used to display messages to the user, initialize program variables and setup the dialog instance by deactivating unused fields or actions the user is not allowed to execute.
INPUT BY NAME cust_rec.* ... BEFORE INPUT MESSAGE "Input customer information" CALL DIALOG.setActionActive("check_info", is_super_user() ) CALL DIALOG.setFieldActive("cust_comment", is_super_user() ) ...
The fields are initialized with the defaults values before the BEFORE INPUT block is executed. When the INPUT instruction uses the WITHOUT DEFAULTS option, the default values are taken from the program variables bound to the fields, otherwise (with defaults), the DEFAULT attributes of the form fields are used.
Use the NEXT FIELD control instruction in the BEFORE INPUT block, to jump to a specific field when the dialog starts.
In an INPUT or INPUT ARRAY sub-dialog of a procedural DIALOG instruction, the BEFORE INPUT block is executed when the focus goes to a group of fields driven by the sub-dialog. This trigger is only invoked if a field of the sub-dialog gets the focus, and none of the other fields had the focus.
When the focus is in a list driven by an INPUT ARRAY sub-dialog, moving to a different row will not invoke the BEFORE INPUT block.
BEFORE INPUT is executed after the BEFORE DIALOG block andbefore the BEFORE ROW, BEFORE FIELD blocks.
In this example, the BEFORE INPUT block is used to set up a specific action and display a message:
INPUT BY NAME p_order.* BEFORE INPUT CALL DIALOG.setActionActive("validate_order", TRUE)