Set focus to element
See also: Set focus to next element, Set focus to previous element
Actions – Abstract
The action Set focus to element transfers the focus within a form – as far as technically possible – to the linked Target element.
The action Set focus to element transfers the focus within a form – as far as technically possible – to the linked Target element.
If no target element is linked, then the executing element is considered the target element.
►NOTE◄ The action can only be executed if an element is already linked. However, the link can then be removed.
If a target element is linked, the focus is transferred to the target element. If this fails, the focus remains unchanged.
The Target element must meet the following criteria in order to be focused:
The element must be of a type that is focusable. An Image/Icon cannot do this, e.g. while a Button can be focussed.
The element must be 'active' and 'visible'. This is the case, if the options 'Active' and 'Visible' are set for the element itself as well as all of its parent containers.
The element must not have become 'active' (Enable element) and/or 'visible' (Show element) by other actions in the same behaviour that sets the focus (see example below).
►NOTE◄
In contrast to the actions Set focus to next element and Set focus to previous element , a target element becomes focusable even if it is considered 'read-only', i.e. the option 'Read only' is set for the element itself or one of its parent containers.
If the target element is located in a partially accessible area of the form (in a Tab panel or Expandable element), this area is made completely visible by the action Set focus to element. This is done regardless of whether the target element can actually accept the focus, i.e. even if it is not 'active' and/or not 'visible' (see example below).
Example
An input form for Shipments provides a Tab panel element for the input of shipment details in groups (per tab).
While information on Pickup and Destination is mandatory, the Transport and Dangerous goods tabs are initially hidden. They should only appear if the user clicks a Button in the Destination tab.
The respective button not only makes the tab visible, but also selects it immediately.
Configuration:
Only the configuration for the Continue with 'Transport' Button is presented here, to demonstrate the possible uses for the action Set focus to element.
|
When clicking on the Continue with 'Transport' Button, the behaviour 'show tab' is called first, which will not be presented in detail here.
The behaviour 'set focus' does not use a custom Triggering event, because it should only be called by Execute behaviour in the 'show tab'. Under Execute later once (ms), a small time delay of 10 milliseconds is defined. This ensures that the Transport tab, which has just been defined as visible by calling the behaviour 'show tab', and the Form elements it contains, are processed by the browser so that the focus can be set within the tab in the next step. The Behaviour type Static determines via the preset default value 'ON' (or 'True') that the Actions on 'true' are always executed. Under the Actions on 'true', the Set focus to element action is called:
|
Appearance during runtime:
Before clicking on 'Continue with Transport' |
After clicking on 'Continue with Transport' |
|
|
After closing the expandable area |
|
|
|
Before clicking on 'Continue with Transport' again |
After clicking on 'Continue with Transport' again |
|
|