webtrigger onFocus
This web trigger is used to program behavior when the DSP widget gets focus as a result of user interaction.
Declaration: | webtriggeronFocus |
Parameters: | None |
Applies to: | This trigger is applicable only on HTML-based DSP widgets that can get and lose focus. |
Activation: | Activated when the widget receives focus by the user tabbing to, or clicking on, a field in a DSP. |
Default behavior: | None |
Behavior upon completion: | None |
Description
If defined, the onFocus trigger is fired when the widget receives focus, by the user tabbing to or clicking on a field in a DSP. The onBlur trigger can be used to reverse the effects caused by the onFocus trigger.
Using onFocus
In the following example, a web trigger displays a <div> element as a popup when the field gets the focus.
A HTML <div> element is defined in the layout as:
<div id="popover" style="visibility: hidden;">Use uppercase letters only.</div>
The following onFocus trigger displays the element:
webtrigger onfocus scope output endscope javascript document.getElementById('popover').style.visibility = 'visible'; endjavascript end
The effect can be reversed in the onBlur trigger:
webtrigger OnBlur javascript document.getElementById('popover').style.visibility = 'hidden'; endjavascript end