User interface / The interaction model |
DIALOG ... ON ACTION dialogtouched LET changing = TRUE CALL DIALOG.setActionActive("dialogtouched", FALSE) ... END DIALOG
The dialogtouched action works for any field controlled by the current interactive instruction, and with any type of form field: Every time the user modifies the value of a field (without leaving the field), the ON ACTION dialogtouched block will be executed; This can be triggered by typing characters in a text editor field, clicking a checkbox / radiogroup, or modifying a slider.
You may only want to detect the beginning of a record modification, to enable a "save" action for example. To prevent further dialogtouched action events, disable the action with a DIALOG.setActionActive() method. When the dialogtouched action is enabled, the ON ACTION block will be invoked each time the user types characters in an editable field.
The current field may contain some text that does not represent a valid value of the underlying field data type. For example, a form field bound to a DATE variable may contain only a part of a valid date string, such as [12/24/ ]. For this reason, the target variable cannot hold the current text displayed on the screen when the ON ACTION dialogtouched code is executed, even when using the UNBUFFERED mode.
To avoid data validation on action code execution, the dialogtouched action is defined with validate="no" attribute in the default action defaults file. This is mandatory when using the UNBUFFERED mode; otherwise the runtime would try to copy the input buffer into the program variable when a dialogtouched action is invoked. Since the text of the current field will in most cases contain only a part of a valid data value, using validate="yes" would always result in a conversion error.