<xf:setfocus>action and the the
<xf:setfocus>action allows the form author to change the focus to a particular control. It is similar to the HTML
focus()function, with handling of grouping controls as a nice bonus feature.
input-onlyextension attribute, when set to
true, changes the behavior of the action by allowing focus only on the
<xf:input>control. This means that buttons (
<xf:trigger>) in particular are excluded.
excludesattribute allow filtering which controls are allowed to receive focus when using
input-only="true"which is equivalent to
<xf:setindex>action, the following logic takes place if the index changes:
<xf:setindex>, XForms enforces that a control within a hidden case or dialog cannot have focus. If a focused control is within a case or dialog and the case is hidden via
<xf:toggle>or the dialog closed via
<xxf:hide>, focus is removed from that control.
<xxf:show>, and focus was on a control outside the dialog, focus is first removed.
<xf:delete>actions can immediately:
@caserefattribute, cases can become hidden
<xf:delete>actions takes place
xxforms-dialog-openevent. In this example, the form author sets focus on
name-input(which would receive focus by default as it is the first control):
defaultAction="cancel"ensures that after the overridden behavior has completed, the default algorithm above does not take place.
DOMFocusOutto the control that previously had focus, if any
DOMFocusOutto the ancestor grouping controls of the control that previously had focus, if any
DOMFocusInto the ancestor grouping controls of the control that is gaining focus, if any
DOMFocusInto the control that is gaining focus, if any
targetattribute on event handlers to make sure that focus changes are detected on the expected control:
xforms-focusevent should usually be considered an internal event used by the
xf:setfocusaction. However, it is useful to know about this event in two situations:
<xxf:dialog>, or an XBL control:
<xf:case>control is recursively searched and the first descendant control able to receive focus receives it
xforms-focusevent does not bubble.