In dialog parts driven by a simple INPUT, INPUT ARRAY or by a CONSTRUCT sub-dialog, the AFTER FIELD block is executed every time the focus leaves the specified field. For editable lists driven by INPUT ARRAY, this block is executed when moving the focus from field to field in the same row, or when moving to another row in the same column.
The AFTER FIELD keywords must be followed by a list of form field specifications. The screen-record name can be omitted.
AFTER FIELD is executed before AFTER INSERT, ON ROW CHANGE, AFTER ROW, AFTER INPUT or AFTER CONSTRUCT.
When a NEXT FIELD instruction is executed in an AFTER FIELD block, the cursor moves to the specified field, which can be the current field. This can be used to prevent the user from moving to another field / row during data input. Note that the BEFORE FIELD block is also executed when NEXT FIELD is invoked.
The AFTER FIELD block of the current field is not executed when performing a NEXT FIELD; only BEFORE INPUT, BEFORE CONSTRUCT, BEFORE ROW, and BEFORE FIELD of the target item might be executed, based on the sub-dialog type.
When ACCEPT DIALOG, ACCEPT INPUT or ACCEPT CONTRUCT is performed, the AFTER FIELD trigger of the current field is executed.
Use the AFTER FIELD block to implement field validation rules:
INPUT BY NAME p_item.* ... AFTER FIELD item_quantity IF p_item.item_quantity <= 0 THEN ERROR "Item quantity cannot be negative or zero" LET p_item.item_quantity = 0 NEXT FIELD item_quantity END IF