The setfocus element

Release 2.0 - ...

This action dispatches an xforms-focus event to the element identified by attribute control or child element control.

The identity of the element to which the setfocus action dispatches xforms-focus is given by the control attribute or the control (child) element. If both are given, the element takes precedence.

Due to the addition of the element, the control attribute is no longer required, but either the control attribute or the control element must appear.

Example

XML CopyCode image Copy Code
<xforms:setfocus ev:event="xforms-value-changed" control="City" if="string-length(.)=6 and . &gt; 0"/>

Attributes

Name Required / optional Description
control optional Reference to a form control. The form control is specified by this attribute or by the child element control.
Common Attributes optional Any attribute from the Common Attributes collection (e.g. id).
XML Events optional Any attribute from the XML Events collection (e.g. ev:event)
Common Action Attributes optional Any attribute from the Common Action Attributes collection (if or while)

Content

The setfocus element does allow a single control child element.

Specification

Link to the XForms specification: the setfocus element.

Topics