keypressAdded by IBM on October 10, 2012 | Version 1 (Original)
|Contains the last keystroke or keystroke combination made by the user in the focused item, page, or form.
A keypress option is ignored if no keypress has been established at the level of focus. If the value of a keypress option is ignored at the item level, it passes up to the page level, and if ignored at the page level, it passes up to the form level. This option allows for the creation of a default button (shortcut key) on a page or a form.
This option is not saved or transmitted as part of the form. Instead, it is automatically created each time the form is read into memory, and is maintained only during display or processing.
Table 1. keypress parameters
|Key pressed||ESC||escape key|
|NUMPAD_ ENTER||number pad enter key|
|" "||space bar|
|F[1-12]||function key (can be any key from F1 to F12)|
|any alphanumeric char||Any upper or lower case alphanumeric key on the keyboard. For example 'd' or 'T'. |
|ALT/CTRL[a-z/A-Z]||Alt or Ctrl + any upper or lower case alpha key on the keyboard. For example 'Alt + G' or 'Ctrl + q'
- This key combination can only be used in the Viewer. It is not supported in Webform Server .
- Some Ctrl and Alt keypress combinations overlap with existing Viewer hot keys such as Ctrl + a. Hot key actions are evaluated before keypress options.
Available In button, field, combobox, popup, list, radio, check, page global, form global
Example The following example shows how you can set the keypress options to the Ctrl + G keys at the page global and global levels. When the form’s user presses the Ctrl + Shift + g keys, it activates the CancelButton’s cancel action and the text "You pressed Ctrl + G" is then displayed in the field and a save dialog box is displayed.
<custom:myoption xfdl:compute="toggle(PAGE1.global.keypress, '', 'CTRL+g')
== '1' ?
set ('CancelButton.activated','on'): ''"></custom:myoption>
<custom:my xfdl:compute="toggle(global.global.keypress, '', 'CTRL+g')
== '1' ?
set ('FIELD1.value','You pressed Ctrl + G'): ''"></custom:my>
- Default: none
- The keypress option enables the use of a default button or action on the form.
- You cannot place a compute in the activated option of a button. You must place it in a custom option.
- The keypress option is not saved or transmitted with form descriptions.