Even though AVTs and <xforms:output> elements may be placed before any XForms
model, they are still considered part of the XForms "view" of the XForms document and refer to data placed in
models.
XForms Reference: XForms Extensions
- 1. Introduction
- 2. XPath 2.0 Expressions
- 3. Placement of Controls and Models
- 4. Custom Model Item Properties
- 5. Extension Model Item Property to Specify default instance values
- 6. Standalone Label, Hint, Help and Alert Elements
- 7. Read-Only Mode
- 8. Formatting
- 8.1. Rationale
- 8.2. xforms:output
- 8.3. Default Formatting
- 9. Iteration of XForms Actions over Sequences
- 10. Generalized context attribute
- 11. Enhanced event() Function Support
- 12. Enhanced <xforms:dispatch> Support
- 13. Targeting effective controls within repeat iterations
- 14. Validation Extensions
- 14.1. Extension Events
- 14.2. Extension Types
- 14.3. Controlling the XML Schema Validation Mode
- 15. JavaScript Integration
- 16. Attribute Value Templates
- 16.1. AVTs on XForms Elements
- 16.2. AVTs on XHTML Elements
- 17. Variables
- 18. Dialogs
- 19. Submission Extensions
- 19.1. HTTP Authentication
- 19.2. HTTP Headers Forwarding
- 19.3. Loading Indicator
- 19.4. Target
- 19.5. xxforms:instance Attribute
- 19.6. xxforms:xinclude Attribute
- 19.7. Submitting Text Content
- 19.8. Submitting HTML or XHTML Content
- 19.9. Submitting Binary Content
- 20. Other Extensions
- 20.1. <xxforms:script> Action
- 20.2. Read-Only XForms Instances with xxforms:readonly
- 20.3. Caching of XForms Instances with xxforms:cache
- 20.4. Controlling Item Sets Refreshes with xxforms:refresh-items
- 20.5. xxforms:internal Appearance on <xforms:group>
- 20.6. Trees with the xxforms:tree Appearance
- 20.7. Menus with the xxforms:menu Appearance
- 20.8. Autocomplete box xxforms:tree Appearance
- 20.9. Multiple Event Names, Observers and Targets on Event Handlers
- 20.10. xxforms:download Appearance on <xforms:output>
- 20.11. xxforms:group Attribute on <xforms:select1> with appearance="full"
1. Introduction
This part of the XForms reference documentation focuses on XForms extensions provided by Orbeon Forms.
2. XPath 2.0 Expressions
Orbeon Forms uses XPath 2.0 expressions instead of XPath 1.0 expressions as mandated by XForms. This allows much greater flexibility in the expressions you can use in Orbeon Forms (and once you have tasted XPath 2.0, you can't go back to XPath 1.0!).
In general, this does not cause incompatibilities: most XPath 1.0 expressions work without issues
with an XPath 2.0 implementation. But one place where there is an incompatibility is the use of the
XPath 1.0 if() function. This function clashes with XPath 2.0's built-in
if() construct. The bottom line is that you cannot directly use the XForms
if() function in Orbeon Forms at the moment. The following, for example, will not work
in Orbeon Forms:
But you have workarounds:
-
Use the XPath 2.0
if (...) then ... else ...construct instead:if (normalize-space(/first-name) = '') then '' else concat('Hello, ', /first-name, '!') -
Use the Orbeon Forms
xxforms:if()extension, which behaves like the XFormsif()function:xxforms:if (normalize-space(/first-name) = '', '', concat('Hello, ', /first-name, '!'))
3. Placement of Controls and Models
XForms does not specify normatively where XForms controls and models must be placed within an HTML
document. The convention is to place
<xforms:model> elements within <xhtml:head>, and controls within
<xhtml:body>. Orbeon Forms is more flexible on this:
-
<xforms:model>can be placed within<xhtml:head>as is usual, but also under<xhtml:body>and even nested within other XForms elements. For example:<xxforms:dialog id="my-dialog" model="my-dialog-model"><xforms:label>My Dialog</xforms:label><xforms:group>...</xforms:group><xforms:model id="my-dialog-model"><!-- Model used by the dialog -->...</xforms:model></xxforms:dialog>In this particular case, this allows you to write your dialog as a module in a completely separate file and to XInclude that file within your main form.
At the moment, nested models behave exactly as if they were placed under
<xhtml:head>. It is just a syntactic convenience to be able to place them within elements such as<xxforms:dialog>. -
Attribute Value Templates (AVTs) can be placed on HTML elements outside
<xhtml:body>.<xhtml:body lang="{instance('language')}">...</xhtml:body> -
A single
<xforms:output>control may be placed within<xhtml:title>. This allows dynamically changing the HTML document title using XForms.<xhtml:title><xforms:output value="instance('resources')/title"/></xhtml:title>
4. Custom Model Item Properties
You can place user-defined Model Item Properties (MIP) on the <xforms:bind> element. Any
attribute not in a standard Orbeon namespace is interpreted as a custom MIP:
The value of the attribute must be a valid XPath expression. The expression result is converted to a string to set the MIP value.
Custom MIPs have the side effect of placing CSS classes on controls bound to affected nodes. Class names are computed as the concatenation of:
- MIP attribute prefix
- "-"
- MIP attribute local name
- "-"
- MIP value
With the example above, the following class names can be set: foo-bar-is-g or
foo-bar-is-not-g.
5. Extension Model Item Property to Specify default instance values
In XForms, default or initial values can be set by pre-populating an instance document's elements and attributes with initial data, for example:
For dynamic values, for example coming from request parameters or session values, there is no
declarative notation and you must use xforms-submit-done or
xforms-submit-ready, which is sometimes cumbersome:
For convenience, Orbeon Forms support an extension model item property:
xxforms:default. It works like the standard calculate, except that it is
evaluated only once, just before the first evaluation of the calculate expressions if
any.
6. Standalone Label, Hint, Help and Alert Elements
In XForms, <label>, <hint>, <help> and
<alert> ("LHHA") elements must always be nested within a control. In HTML on the
other hand, the <label> element supports a for attribute which relates
the element to a control. Orbeon Forms follows HTML and support the for attribute on
all the LHHA elements. This allows placing LHHA elements in other locations on the page:
Standalone LHHA elements must not cross <xforms:repeat> boundaries.
7. Read-Only Mode
7.1. Making an Entire Instance Read-Only
You often want to present a form without allowing the user to enter data. An easy solution is to use
the readonly MIP in the model. By making for example the root element of an instance
read-only, all the controls bound to any node of that instance will appear read-only (because the
read-only property is inherited in an instance):
7.2. Static Appearance for Read-Only Mode
Sometimes, read-only controls don't appear very nicely in web browsers. For example, a combo box will appear grayed out. It maybe be hard to read, and there is not much point showing a combo box since the user can't interact with it. Furthermore, with some browsers, like IE 6 and earlier, it is not even possible to make disabled controls appear nicer with CSS. In order to make read-only versions of forms look nicer, Orbeon Forms supports a special extention attribute that allows you to produce a "static" appearance for read-only controls. You enable this on your first XForms model:
The attribute takes one of two vales: static or dynamic (the default).
When using the value static, read-only controls do not produce disabled HTML form
controls. This has one major limitation: you can't switch a control back to being read-write once
it is displayed as read-only.
You can also set the xxforms:readonly-appearance attribute directly on individual
XForms controls.
See the Government Forms sample application's View Read-Only option for an example of this feature in action.
8. Formatting
8.1. Rationale
It is usually recommended to use native XML types within XForms instances, as this guarantees
interoperability and maintainability. For example, a date of January 10, 2005 is stored in ISO
format as: 2005-10-01. However it is often necessary to format such values on screen
in a user-readable format, like "January 10, 2005", "10 janvier 2005", or "10. Januar 2005".
Orbeon Forms provides an extension attribute, xxforms:format, for that purpose.
xxforms:format must contain an XPath 2.0 expression. In your XPath expression you can
use all the XPath 2.0 functions, including those for date manipulation (external
documentation). However since XPath 2.0 functions don't provide any facility for date and time
formatting, you can in this attribute also use the following XSLT 2.0 functions:
-
format-date()(external documentation) -
format-dateTime()(external documentation) -
format-time()(external documentation) -
format-number()(external documentation)
The XPath expression is evaluated by the XForms engine whenever the value bound to the
xforms:input control changes and needs to be updated on screen. It is evaluated in the
context of the instance node bound to the control. This means that the current value of the control
can be accessed with ".". Often the value must be converted (for example to a date) in
which case the conversion can be done with a XPath 2.0 constructor such as xs:date(.)
or with as cast such as (. cast as xs:date?).
8.2. xforms:output
When using xforms:output, you can control the formatting of the date using the
xxforms:format extension attribute on the xforms:output control.
8.3. Default Formatting
For both xforms:input and xforms:output, if the bound node is of one of
the following types: xs:date, xs:dateTime, xs:time,
xs:decimal, xs:integer, xs:float, and xs:double,
and if no xxforms:format attribute is present on the control, formatting is based on
properties. If the properties are missing, a built-in default
formatting is used. The default properties, as well as the built-in defaults, are as follows:
They produce results as follows:
-
2004-01-07asxs:dateis displayed asWednesday January 7, 2004 -
2004-01-07T04:38:35.123asxs:dateTimeis displayed asWednesday January 7, 2004 04:38:35 UTC -
04:38:35.123asxs:timeis displayed as04:38:35 UTC -
123456.789asxs:decimalis displayed as123,456.79 -
123456.789asxs:integeris displayed as123,456 -
123456.789asxs:floatorxs:doubleis displayed as123,456.789
Note:
- With the "if" condition in the XPath expressions, a value which cannot be converted to the appropriate type is simply displayed as is.
- For values of type xs:time or xs:dateTime, if you wish the time to be displayed using the current timezone instead of UTC, replace in the value attribute UTC by [ZN].
9. Iteration of XForms Actions over Sequences
Orbeon Forms supports the exforms:iterate attribute, also available as
xxforms:iterate attribute, on XForms action elements. Consider the following
instances:
The following action iterates over the <title> elements of
source-instance. For each of those, a new <book> element, copied from
the template stored in template-instance, is inserted into main-instance.
Then values from the <title> and <author> elements are copied over
to the new structure. The XForms 1.1 context() function provides access to each of the
iterated nodes:
The resulting main-instance is as follows:
Note that because Orbeon Forms uses XPath 2.0, xxforms:iterate is not limited to
returning node-sets, but can return sequences of items such as strings.
For more information about eXforms extensions, please visit the eXforms site.
10. Generalized context attribute
XForms 1.1 introduces the context attribute on <xforms:insert> and
<xforms:delete>. Orbeon Forms supports this convenient attribute on all XForms
elements changing the XPath evaluation context, including controls, actions, binds, and
submissions.
The context attribute overrides the in-scope XPath evaluation context for an action. It
applies before the ref and context attributes, but after the
model attribute.
One convenient use is to just change the context within a group:
Note that it is also possible to use ref in this case, but doing so has the side effect
of binding the group to an instance data node, which may affect group relevance, for example.
11. Enhanced event() Function Support
This section has migrated to the wiki.
12. Enhanced <xforms:dispatch> Support
This section has migrated to the wiki.
13. Targeting effective controls within repeat iterations
This section has migrated to the wiki.
14. Validation Extensions
14.1. Extension Events
Orbeon Forms supports extensions events dispatched to an instance when it becomes valid or
invalid: xxforms-valid and xxforms-invalid. These events are
dispatched just before xforms-revalidate completes, to all instances of the model
being revalidated. For a given instance, either xxforms-valid or
xxforms-invalid is dispatched for a given revalidation.
These events can be used, for example, to toggle the appearance of icons indicating that a form is valid or invalid:
14.2. Extension Types
Orbeon Forms supports the built-in xxforms:xml extension type. This types checks
that the value is well-formed XML:
Note that this checks the string value of the node, which means that the node must contain escaped XML.
Orbeon Forms supports the built-in xxforms:xpath2 extension type. This types
checks that the value is well-formed XPath 2.0. Any variable used by the expression is assumed
to be in scope:
In both these cases, Orbeon Forms checks for the required MIP: if it evaluates
to false() and the value is the empty string, then the instance data node is
considered valid. This is contrary to XForms 1.1 as of August 2008.
14.3. Controlling the XML Schema Validation Mode
When an XML Schema is provided, Orbeon Forms supports controlling whether a particular instance is validated in "lax" mode, "strict" mode, or not validated at all.
Orbeon Forms implements a "lax" validation mode by default, where only elements that have definitions in the imported schemas are validated. Other elements are not considered for validation. This is in line with XML Schema and XSLT 2.0 lax validation modes, and with the default validation mode as specified in XForms 1.1
In addition, the author can specify the validation mode directly on each instance with the
extension xxforms:validation attribute, which takes values lax
(the default), strict (the root element has to have a definition in the schema
and must be valid), or skip (no validation at all for that instance).
Nodes validated through a schema receive datatype annotations, which means that if an element
or attribute is validated against xs:date in a schema, an XForms control bound to
that node will display a date picker.
15. JavaScript Integration
This section has migrated to the wiki.
16. Attribute Value Templates
Certain attributes in XForms are literal values defined by the form author at the time the form is
written, as opposed to being evaluated at runtime. Examples include the action
attribute on <xforms:submission>, or the resource attribute on
<xforms:load>.
To improve this, Orbeon Form supports a notation called Attribute Value Templates (AVTs),
borrowed from XSLT, which allows including XPath
expressions within attributes. You include XPath expressions in attributes by enclosing them within
curly brackets ({ and }).
16.1. AVTs on XForms Elements
Consider this example:
When <xforms:load> is executed, the resource attribute is
evaluated. The results is the concatenation of /forms/detail/ and of the result of
the expression within brackets:
If the id element pointed to contains the string
C728595E0E43A8BF50D8DED9F196A582, the resource attribute takes the
value:
Note the following:
-
If you need curly brackets as literal values instead of enclosing an XPath expression, escape them using double brackets (
{{and}}). -
You can use as many XPath expressions as you want within a single attributes, each of them enclosed by curly brackets.
AVTs are currently supported on the following attributes:
-
<xforms:submission>attributes:-
method -
actionandresource -
serialization -
mediatype -
version -
encoding -
separator -
indent -
omit-xml-declaration -
standalone -
validate -
relevant -
mode -
xxforms:target -
xxforms:username -
xxforms:password -
xxforms:readonly -
xxforms:shared -
xxforms:xinclude
-
-
<xforms:dispatch>attributes:-
name -
target -
bubbles -
cancelable -
delay -
xxforms:show-progress -
xxforms:progress-message
-
-
<xforms:load>attributes:-
resource -
replace -
xxforms:target -
xxforms:show-progress -
f:url-type
-
-
<xforms:setfocus>:controlattribute. -
<xforms:toggle>:caseattribute. -
<xxforms:show>attributes:-
dialog -
neighbor -
constrain
-
-
<xxforms:hide>:dialogattribute. -
All controls:
-
style: equivalent to the HTMLstyleattribute
-
-
<xxforms:input>and<xxforms:secret>attributes:-
xxforms:size: equivalent to the HTMLsizeattribute -
xxforms:maxlength: equivalent to the HTMLmaxlengthattribute -
xxforms:autocomplete: equivalent to the HTMLautocompleteattribute
-
-
<xxforms:textarea>attributes:-
xxforms:cols: equivalent to the HTMLcolsattribute -
xxforms:rows: equivalent to the HTMLrowsattribute -
xxforms:maxlength: equivalent to the HTML 5rowsattribute (NOTE: this HTML 5 attribute is not supported by most browsers as of March 2009)
-
There are plans to support AVTs in more places in the future. Please send your suggestions!
16.2. AVTs on XHTML Elements
AVTs are also supported on XHTML elements. You must first enable this feature in
properties.xml:
For example:
In the above example, the value of the class attribute on
<xhtml:tr> is determined dynamically through XPath and XForms. Even table rows
get the class zebra-row-even and odd table rows get the class
zebra-row-odd.
The values of XHTML attributes built using AVTs update as you interact with the XForms page. In
the example above, inserting or deleting table rows after the page is loaded will still
correctly update the class attribute.
It is also possible to use AVTs outside <xhtml:body>, for example:
AVTs are also usable on HTML elements within <xforms:label>,
<xforms:hint>, <xforms:help>, <xforms:alert>:
It is not possible to use AVTs within the id attribute of XHTML elements.
17. Variables
This section has migrated to the wiki.
18. Dialogs
18.1. The xxforms:dialog Control
You declare dialogs directly under the <xhtml:body> element with:
-
When you have
appearance="full"on the dialog, you define the title of the dialog with the embedded<xforms:label>element. -
Inside an
<xxforms:dialog>you can use all the XHTML and XForms elements you can normally use elsewhere on the page. You can have other XForms controls, or show anything you would like to with HTML. -
The attributes on the
<xxforms:dialog>are as follows:
id |
Mandatory |
The ID of the dialog. You reference this ID when opening the dialog with
<xxforms:show dialog="my-dialog-id">.
|
|---|---|---|
| appearance |
Optional. Possible values are:
|
You can set the appearance to either full or minimal:
|
level |
Optional. Can only be used appearance is set to full. Possible values are:
|
When set to modal the rest the page is grayed out and you can't interact
with any ontrol on the page outside of the dialog. When set to modeless you
can still use other controls on the page.
|
close |
Optional. Can only be used appearance is set to full. Possible values are:
|
A "x" is shown in the dialog title bar when close is set to
true. If you specify close="false", then you should provide a
way to close the dialog, for instance by having you own "Close" button inside the
dialog. This is typically useful when you want to force users to enter some data before
proceeding and you don't want them to cancel the current operation by closing the
dialog.
|
draggable |
Optional. Can only be used appearance is set to full. Possible values are:
|
When set to false, you won't be able to move dialog on the page by using
drag and drop in the dialog title bar.
|
visible |
Optional. Whether the dialog is initially visible when the page loads. Possible values
are:
|
When set to true, the dialog appears immediately when the page loads.
|
neighbor |
Optional |
Optional. Use only with minimal appearance. The id of the control next to
which the dialog should display when opening.
|
18.2. The xxforms:show and xxforms:hide Actions
You open a dialog by using the xxforms:show action:
If the dialog is already open, no action takes place.
xxforms:show supports the following attributes:
dialog |
Mandatory | The id of an existing dialog to open. |
|---|---|---|
neighbor |
Optional |
Optional. Use only with minimal appearance. The id of the control next to
which the dialog should display when opening.
|
constrain |
Optional |
Whether to constrain the dialog to the viewport. Possible values
are:
|
You close a dialog by using the xxforms:hide action:
If the dialog is already closed, no action takes place.
xxforms:hide supports the following attributes:
dialog |
Mandatory | The id of an existing dialog to close. |
|---|
18.3. The xxforms-dialog-open Event
Dispatched in response to: xxforms:show action executed with an existing dialog id.
Target: dialog
Bubbles: Yes
Cancelable: Yes
Context Info: none
Default Action: Open the dialog.
You can respond to this event before the dialog opens, for example to perform initialization of data:
18.4. The xxforms-dialog-close Event
Dispatched in response to: xxforms:hide action executed with an existing dialog id.
Target: dialog
Bubbles: Yes
Cancelable: Yes
Context Info: none
Default Action: Close the dialog.
19. Submission Extensions
19.1. HTTP Authentication
The <xforms:submission> element supports optional xxforms:username and
xxforms:password attributes that allow specifying HTTP authentication credentials.
You can specify either both attributes, or only the xxforms:username attribute. The
latter case is equivalent to setting the value of xxforms:password to an empty
string.
19.2. HTTP Headers Forwarding
The <xforms:submission> automatically forwards current HTTP headers specified by the
oxf.xforms.forward-submission-headers property. This property contains a
space-separated list of header names to forward:
It can also be set on a per-page basis on your first model element:
Whenever <xforms:submission> performs an HTTP request, it looks at this list of
header names and it forwards the header value if the following conditions are met:
- There is an incoming header with that name, i.e. either the HTTP request causing the XForms page to load or the XForms Ajax request to run contains that header.
-
There is no author-specifed header with the same name in an
<xforms:header>element within<xforms:submission>.
Forwarding the Authorization or other authentication-related headers can be useful
to propagate authentication credentials to other services.
The Authorization is treated specially: if a username is specified on the
submission with xxforms:username, then this header is never forward.
Forwarding authentication-related headers may cause a security risks when communicated with non-trusted servers. Use carefully!
19.3. Loading Indicator
When an <xforms:submission> with replace="all" is executed, in general,
the browser will load another page. While this happens, the loading indicator, by default shown
in red at the top right of the window, is displayed. However, when the browser is served not a
web page but say a ZIP file, the browser might ask you in you want to download it, and then stay
in the current page. When this happens, the loading indicator does not go away.
In those cases where you know that the target page does not replace the current page, you can
prevent the loading indicator from being displayed by adding the
xxforms:show-progress="false" attribute:
Similarly the xxforms:show-progress="false" attribute can be used with the
xforms:load action:
19.4. Target
You can use the xxforms:target attribute on both <xforms:submission> and
xforms:load. It behaves just like the HTML target attribute.
When used on <xforms:submission>, it makes sense to use this attribute only when you
have a replace="all", as the replace="instance" doesn't load another
page.
19.5. xxforms:instance Attribute
On an <xforms:submission> element with replace="instance", the
optional instance attribute specifies a destination instance for the result. That
attribute is processed like the instance() function, which means that the instance
specified must be in the current model.
The xxforms:instance extension attribute can be use instead of the standard
instance attribute. It works like instance, except that the instance
is searched globally among all models. xxforms:instance is to the
instance attribute what the xxforms:instance() function is to the standard
instance() function.
19.6. xxforms:xinclude Attribute
On an <xforms:submission> element with replace="instance", the
optional xxforms:xinclude attribute specifies whether XInclude processing should be
performed on the XML document returned, before storing it into the destination instance. The
default is false.
19.7. Submitting Text Content
Orbeon Forms supports sending the text content of an XML document as per XSLT 2.0 and XQuery 1.0 Serialization. To perform a text submission:
-
The
postorputmethod is required. -
You must use a the
text/plainvalue for theserializationattribute.
19.8. Submitting HTML or XHTML Content
Orbeon Forms supports sending an XML document as HTML or XHTML as per XSLT 2.0 and XQuery 1.0 Serialization. To perform a HTML or XHTML submission:
-
The
postorputmethod is required. -
You must use a the
text/htmlor theapplication/xhtml+xmlvalue for theserializationattribute.
19.9. Submitting Binary Content
XForms 1.1 does not explicitly support submitting binary content, but does not prohibit it
either. Orbeon Forms supports sending the content of a binary resource specified by a URI. Such
resources are easily obtained with <xforms:upload>, for example. To perform a
binary submission:
-
The
postorputmethod is required. -
You must use a binary
serializationattribute. This includes all mediatypes which are not XML or text, includingapplication/octet-stream,image/*, etc. -
The node referred to by the submission must be of type
xs:anyURI.
Alternatively, you can set the type information using the xsi:type attribute:
20. Other Extensions
20.1. <xxforms:script> Action
The <xxforms:script> action allows you to call client-side JavaScript as a
result of XForms events:
Scripts run with <xxforms:script> have access to the following JavaScript
variables:
-
this. The element observing the event causing
<xxforms:script>to run. -
event. Object containing a "target" propeterty.
event.targetreturns the element which is the target of the event causing<xxforms:script>to run.
<xxforms:script> actions are currently always executed last in a
sequence of XForms actions, even if they appear before other XForms actions.
20.2. Read-Only XForms Instances with xxforms:readonly
Orbeon Forms supports an extension attribute, xxforms:readonly, on the
<xforms:instance> and <xforms:submission> elements. When set to
true, this attribute signals that once loaded, the instance is read-only, with the
following consequences:
-
The instance is loaded into a smaller, more efficient, read-only data structure in memory.
-
Instance values cannot be updated, and no Model Item Properties (MIPs) can be assigned with
<xforms:bind>to the instance. But a read-only instance can be replaced entirely by an<xforms:submission replace="instance"> -
When using client-side state handling, less data might be transmitted between server and client.
Read-only instances are particularly appropriate for loading internationalization resources, which can be large but don't change. Example:
The xxforms:readonly attribute on <xforms:instance> determines if
the instance is read-only until that instance is being replaced. After an instance is replaced,
it can be read-only or not irrelevant of the of xxforms:readonly on
<xforms:instance>. When the instance is replaced, the replaced instance is
read-only if and only if the <xforms:submission> that does the replacement has a
attribute xxforms:readonly="true".
When this attribute is set to true on <xforms:submission> and if the
targetref attribute is specifed, the replacement target must be an instance's root
element.
20.3. Caching of XForms Instances with xxforms:cache
Orbeon Forms supports a boolean extension attribute, xxforms:cache, on the
<xforms:instance> and <xforms:submission> elements. This attribute
can be used with instances that are read-only or read-write. When set to true:
-
The instance can be shared at the application level. It is identified by its source URL and, in the case of a submission with POST or PUT method, by the body of the request sent.
-
The instance is not stored into the XForms document's state, but in a global cache, therefore potentially saving memory. If, upon loading an XForms instance or running a submission, the instance is found in the cache, it is directly retrieved from the cache. This can save time especially if the URL can take significant time to load.
-
The instance stored in cache is read-only. If the
xxforms:readonlyattribute is set to true (on<xforms:instance>or<xforms:submission>), a single copy of the instance is used in memory. Otherwise, a read-write copy is made. -
In general, the URL should refer to a constant or rarely-changing XML document, and authorization credentials such as username and password should not cause different data to be loaded.
xxforms:shared attribute. Using
xxforms:cache="true" is equivalent to using xxforms:shared="application".
Using xxforms:cache="false" is equivalent to using
xxforms:shared="document".
Here is how you use the attribute on <xforms:instance>:
When used on <xforms:submission>, the submission has to use
method="get", method="post" or method="put" method and
replace="instance":
xxforms:cache="true" with these methods carefully, typically for calls to services you
know are idempotent. Otherwise, incorrect or stale data might be returned by the submission.
You set the size of the shared instances cache using a property in properties.xml:
You can force the XForms engine to remove a shared instance from the cache by dispatching the
xxforms-instance-invalidate event to it. The next time an XForms document requires
this instance, it will not be found in the cache and therefore reloaded. Example:
The xxforms:invalidate-instance action allows invalidating a shared instance by
resource URI, for example:
This action also supports the xinclude attribute, which if present will only invalidate
the instance with the given resource if it was loaded with a matching xxforms:xinclude
attribute:
If the xinclude attribute is not specified, any shared instance matching the resource
URI is invalidated.
It is also possible to remove all shared instances from the cache by using the
xxforms:invalidate-instances action, for example:
The xxforms:ttl attribute can be used to set a time to live for the instance in
cache. This duration is expressed in milliseconds and has to be greater than zero. When a shared
instance if found in cache but has an associated time to live, if it was put in the cache more than
time to live milliseconds in the past, then the instance is discarded from the cache and retrieved
again by URI as if it had not been found in cache at all. The following example expires the shared
instance after one hour:
xxforms:cache="true", be sure that the data contained in the instance does
not contain information that could be inadvertently shared with other XForms documents. It is
recommended to use it to load localized resources or similar types of data.
20.4. Controlling Item Sets Refreshes with xxforms:refresh-items
XForms specifies that items and itemsets are re-evaluated when processing
xforms-refresh. This may happen quite often, and may lead to time-consuming
re-evaluations especially when there are many or large itemsets.
Orbeon Forms supports an extension attribute, xxforms:refresh-items, on the
<xforms:select> and <xforms:select1> elements. When set to
true (the default), items and itemsets are re-computed upon
xforms-refresh event processing. When set to false, this attribute
signals that once computed, the set of items for the control will not be recomputed upon
xforms-refresh event processing.
If you know that itemsets do not change over time, setting xxforms:refresh-items to
false disables refreshing of the items during xforms-refresh and may
yield significant performance improvements. For example:
20.5. xxforms:internal Appearance on <xforms:group>
<xforms:group> supports the xxforms:internal appearance, which
causes the group to have no representation at all on the client:
In general you won't have a need for this appearance, but it is useful as an optimization, as it leads to less HTML sent to the client. You may use it when a group is used only to change the in-scope evaluation context for nested controls and when you don't need changes to relevance which apply directly to the group to be reflected in the client.
20.6. Trees with the xxforms:tree Appearance
[TODO: describe the Orbeon Forms xxforms:tree appearance on
xforms:select and xforms:select1]
20.7. Menus with the xxforms:menu Appearance
[TODO: describe the Orbeon Forms xxforms:tree appearance on
xforms:select1]
20.8. Autocomplete box xxforms:tree Appearance
[TODO: describe the Orbeon Forms xxforms:autocomplete appearance on
xforms:select and xforms:select1]
20.9. Multiple Event Names, Observers and Targets on Event Handlers
This section has migrated to the wiki.
20.10. xxforms:download Appearance on <xforms:output>
<xforms:output> supports the xxforms:download appearance, which
causes the the resource identified by the single-node binding to be downloadable through a
link.
Like <xforms:upload>, when using this appearance,
<xforms:mediatype> and <xforms:filename> children elements are
allowed (but not the <xxforms:size> element). When serving the file, if these
elements are present, they are passed to the resulting HTTP response to provide mediatype and
file name hints to the browser. Example:
The data type for the resource must be xs:anyURI or xs:base64Binary.
20.11. xxforms:group Attribute on <xforms:select1> with appearance="full"
<xforms:select1> supports an extension attribute called xxforms:group
which allows grouping a series of radio buttons together in a way similar to the name
attribute in HTML.
In general, this attribute is not necessary. It is useful in the following case:
-
Multiple
<xforms:select1 appearance="full">point to the same node. -
You enable deferred event handling on the client.
The xxforms:group attribute must contain an identifier unique between groups of radio
controls. Example:

