Field-specific enabled actions

The ON ACTION interaction block of singular dialogs or sub-dialogs in DIALOG instruction, can also be defined with the INFIELD field-name clause. The same action name can be used for several fields. With the INFIELD clause, the action will only be active when the focus is in one of the fields.
INPUT ARRAY custarr WITHOUT DEFAULTS FROM sr_cust.*
  ON ACTION zoom INFIELD cust_city
    LET custarr[arr_curr()].cust_city = zoom_city() 
  ON ACTION zoom INFIELD cust_state
    LET custarr[arr_curr()].cust_state = zoom_state() 
END INPUT
Actions defined with the INFIELD field-name clause can be identified with the field name as prefix:
field-name.action-name

Bind action views with field name prefix to identify the action specifically to a field, or use the action name only. Without the field name prefix, the action view is enabled and disabled automatically according to the current field. When binding the action view with the fully-qualified name including the field name prefix, the action view will always be active, and the focus will jump to the field if the action is fired.

Actions defined in sub-dialogs of the DIALOG instruction get the name of the sub-dialog as prefix. If ON ACTION action-name INFIELD field-name is used in a sub-dialog, the action object name is prefixed with the name of the sub-dialog, followed by the name of the field. The fully-qualified action name will be:
sub-dialog-name.field-name.action-name

When the field-specific action is invoked (for example by a button of the toolbar bound with the fully-qualified action name) and if the field does not have the focus, the runtime system first selects that field before executing the code of the ON ACTION INFIELD block. The field selection forces data validation and AFTER FIELD of the current field, followed by BEFORE FIELD of the target field associated to the action.

It's still possible to enable and disable field-specific action objects by the program using the DIALOG.setActionActive() method. When specifying a fully-qualified action name with the field name prefix, that field-specific action will be enabled or disabled. When disabled by the setActionActive() method, the corresponding action views will always be disabled, even if the field has the focus. If you do not specify a fully-qualified name in the method call, and if several actions are defined with the same action name in different sub-dialogs and/or using the INFIELD clause, the method will identify the action according to the current focus context. For example, if you define ON ACTION zoom INFIELD cust_city and ON ACTION zoom INFIELD cust_addr, when the focus is in cust_city, a call to DIALOG.setActionActive("zoom", FALSE) will disable the action specific to the cust_city field.

Fields can be enabled or disabled dynamically with the DIALOG.setFieldActive() method. If an ON ACTION INFIELD is declared on a field and if you enable/disable the field dynamically, then the field-specific action (and corresponding action views in the form) will be enabled or disabled accordingly.

For action views bound to field actions with qualifiers, the action defaults defined with the corresponding action name will be used to set the attributes with the default values. In other words, the prefix will be ignored. For example, if an action view is defined with the name "cust_addr.check", it will get the action defaults defined for the "check" action.