Controls functions
xxf:binding()
The xxf:binding()
function returns a control's binding, that is the item or items to which the control is bound. Use this function carefully, as depending on when this function is called during XForms processing, it may refer to stale items. It is usually safe to use xxf:binding()
in response to UI events.
NOTE: This function can return not only nodes, but also atomic items.
[SINCE Orbeon Forms 2018.2]
This function also returns the binding if the control has a binding but is non-relevant. In previous versions, if the control was non-relevant, this function always returned the empty sequence.
xxf:binding-context()
The xxf:binding-context()
function returns the context of a control's binding, that is the single in-scope context item before the control's binding is applied if present. Use this function carefully, as depending on when this function is called during XForms processing, it may refer to stale items. It is usually safe to use xxf:binding-context()
in response to UI events.
NOTE: Before Orbeon Forms 2016.1, this function could return more than one item when called for a component within a repeat. This was incorrect and has been fixed. See #2642.
NOTE: This function is rarely used, and when used is typically used from within XBL components.
NOTE: This function can return not only nodes, but also atomic items.
xxf:case()
The xxf:case()
function returns the id of the currently selected <xf:case>
within the given <xf:switch>
. It is recommended to use this function from XForms actions only.
xxf:cases()
The xxf:cases()
function returns a sequence of ids of <xf:case>
elements within the given <xf:switch>
. It is recommended to use this function from XForms actions only.
xxf:client-id()
[SINCE Orbeon Forms 4.3]
Resolve the XForms object with the id specified, and return the id as used on the client.
Return the empty sequence if the resolution fails.
xxf:component-param-value()
[SINCE Orbeon Forms 2017.1]
The xxf:component-param-value()
function returns the string value of the given parameter of the current XBL component's bound node.
A parameter is specified by:
an attribute on the XBL bound node (which can be an attribute value template (AVT))
or, if not found, a property of the form
oxf.xforms.xbl.$PREFIX.$NAME.$PARAMETER
When not returning an empty sequence, the function returns:
an
xs:string
if the value comes from an attributexs:string
,xs:integer
,xs:boolean
orxs:anyURI
depending on the actual type of the property when the value comes from a property
This function is intended for XBL component implementors.
If the user of the component writes:
The implementor of the component can use the parameter with:
See also fr:component-param-value()
.
xxf:context()
The xxf:context()
function allows you to obtain the single-node binding for an enclosing xf:group
, xf:repeat
, or xf:switch
. It takes one mandatory string parameter containing the id of an enclosing grouping XForms control. For xf:repeat, the context returned is the context of the current iteration.
See also the XForms 1.1 context()
function, which returns the current evaluation context:
xxf:focusable()
[SINCE Orbeon Forms 4.6]
For the given control id, return whether the control is currently focusable.
To be focusable, a control must be relevant and not readonly.
For container controls, the function returns
true()
only if it contains at least one focusable control.For
xf:switch
, the search only takes place in the currentxf:case
.Some controls are never focusable, like controls with appearance
xxf:internal
orxf:var
.
xxf:index()
The xxf:index()
function behaves like the standard XForms index()
function, except that its argument is optional. When the argument is omitted, the function returns the index of the closest enclosing <xf:repeat>
element. This function must always be used within <xf:repeat>
otherwise an error is raised.
xxf:is-control-readonly()
[SINCE Orbeon Forms 2017.1]
The xxf:is-control-readonly()
function returns true()
if and only if the controlled specified by $control-id
exists, is relevant, and is readonly.
xxf:is-control-relevant()
[SINCE Orbeon Forms 2016.3]
The xxf:is-control-relevant()
function returns true()
if and only if the controlled specified by $control-id
exists and is relevant.
xxf:is-control-required()
[SINCE Orbeon Forms 2017.1]
The xxf:is-control-required()
function returns true()
if and only if the controlled specified by $control-id
exists, is relevant, and is required.
xxf:is-control-valid()
[SINCE Orbeon Forms 2017.1]
The xxf:is-control-valid()
function returns true()
if and only if the controlled specified by $control-id
exists, is relevant, and is valid.
xxf:itemset()
The xxf:itemset()
function returns the current value of a given control's itemset.
The first parameter is the id of a selection control (
<xf:select>
or<xf:select1>
).The second parameter is the format to return:
xml
: an XML document, useful when the result is handled directly in XForms; specifically, the document is returnedjson
: a JSON tree, useful when the result is handled from JavaScript
The third, optional parameter determines whether information about selected items is returned
The resulting tree represents the itemset hierarchy as seen by the control, with the following information:
relevant items
hierarchy of the itemset
item label
item value
item help and hint if present [SINCE Orbeon Forms 4.5]
item attributes (JSON only)
class
attribute if presentstyle
attribute if presentxxforms-open
attribute ifxxf:open
is present
which are the currently selected items, if
$selected-items
istrue()
NOTE: Because itemsets re-evaluate during refresh, it is recommended that this function be used only within action handlers responding to refresh events to ensure consistency.
With the following flat instance and itemset:
Example of XML result with xxf:itemset('my-select1', 'xml', true())
(formatted for readability)
In this example, you can access the label of the selected item with xxf:itemset('my-select1', 'xml', true())//item[@selected = 'true']/label
. The following is an example of JSON result with xxf:itemset('my-select1', 'json', true())
(formatted for readability):
With the following hierarchical instance and itemset:
Example of XML result with xxf:itemset('my-select1', 'xml'
, true())` (formatted for readability):
Example of JSON result with xxf:itemset('my-select1', 'json', true())
(formatted for readability):
Example of JSON result with attributes:
xxf:label, xxf:help, xxf:hint, xxf:alert
These functions return a control's current label, help, hint, or alert, given a control id.
If the control is not relevant, or does not have an associated label, help, hint, or alert, the empty sequence is returned.
xxf:pending-uploads()
The xxf:pending-uploads()
function returns the number of known pending uploads in the page.
If there is no pending upload, the function returns 0.
A pending upload is an upload started but not completed yet.
NOTE: The XForms engine is informed of uploads start and completion in an asynchronous way. This function only indicates the best knowledge the server has of the status of uploads at any given time.
See also: [Upload control][?]
xxf:repeat-current()
NOTE: You can often use xxf:context()
or the XForms 1.1 context()
function instead.
The xxf:repeat-current()
function allows you to obtain a reference to an enclosing xf:repeat
's current iteration node. It takes one optional string parameter. If present, the id of the enclosing xf:repeat
is searched. If absent, the function looks for the closest enclosing xf:repeat
.
The xxf:repeat-current()
function must be called from within an xf:repeat
element.
xxf:repeat-items()
[SINCE Orbeon Forms 4.5]
NOTE: This function is also available in previous versions of Orbeon Forms as xxf:repeat-nodeset().
The xxf:repeat-nodeset()
function returns the node-set of an enclosing xf:repeat
. It takes a string parameter containing the id of an enclosing repeat XForms control. When the argument is omitted, the function returns the index of the closest enclosing <xf:repeat>
element. This function must always be used within <xf:repeat>
otherwise an error is raised.
xxf:repeat-position()
The xxf:repeat-position()
function returns an enclosing xf:repeat
's current iteration position. It takes one optional string parameter. If present, the id of the enclosing xf:repeat
is searched. If absent, the function looks for the closest enclosing xf:repeat
.
The xxf:repeat-current()
function must be called from within an xf:repeat
element.
xxf:value()
The xxf:value()
function returns the value for one or more controls. If a control is non-relevant or cannot hold a value (like xf:group
or xf:repeat
), the function returns an empty sequence for that control.
NOTE: You must be careful when using this function as a control's value might be out of date. Keep in mind that control values are updated during refresh.
[SINCE Orbeon Forms 2019.1]
The two-argument function adds the $follow-indexes
argument.
$control-id
the id of the control or controls to find
the id may refer to zero, one, or multiple controls in the case of controls within
xf:repeat
$follow-indexes
if missing, takes the value
true()
.if
false()
This finds the "closest" matching control without checking repeat indexes. When descending into repeat iterations, all repeat iterations are chosen.
Zero, one, or more values can be returned.
if
true()
This finds the "closest" matching control by following repeat indexes when possible. When descending into repeat iterations, the iteration matching the enclosing repeat's current index is chosen.
At most one value is returned.
xxf:formatted-value()
[SINCE Orbeon Forms 2019.1]
The xxf:formatted-value()
function returns the formatted value for one or more controls. If a control is non-relevant or cannot hold a value (like xf:group
or xf:repeat
), the function returns an empty sequence for that control.
$control-id
the id of the control or controls to find
the id may refer to zero, one, or multiple controls in the case of controls within
xf:repeat
$follow-indexes
if missing, takes the value
true()
.if
false()
This finds the "closest" matching control without checking repeat indexes. When descending into repeat iterations, all repeat iterations are chosen.
Zero, one, or more values can be returned.
if
true()
This finds the "closest" matching control by following repeat indexes when possible. When descending into repeat iterations, the iteration matching the enclosing repeat's current index is chosen.
At most one value is returned.
NOTE: You must be careful when using this function as a control's value might be out of date. Keep in mind that control values are updated during refresh.
See also XLB modes.
xxf:visited
Whether the given control has been visited, either by losing focus or via the <xxf:setvisited>
action.
If the control is not found or not relevant, the function returns the empty sequence.
Last updated