Synchronizing repeated content
Last updated
Last updated
This is available since Orbeon Forms 2018.2.
This is an Orbeon Forms PE feature.
Often, forms require some kind of , where you first enter a list of initial information, and then complete the information for each item of the list in more details on a separate screen.
A way of doing this with Orbeon Forms consists in:
using a for the basic information
using a , later in the form, for the details
The difficulty is how to synchronize the two. This is doable with custom XForms code, but it is difficult and error-prone. So Orbeon Forms 2018.2 and newer includes a component which does this synchronization automatically for you.
With Orbeon Forms 2018.2, there is no user interface for this yet. You insert the component by editing the source of the form definition with the toolbox button, and insert a piece of XML in the source.
The synchronization component looks like this:
It takes the following required XML attributes:
left
: the name of the source (or "left") repeated grid or repeated section
right
: the name of the destination (or "right") repeated grid or repeated section
version
: must be 2018.2
In addition, it can automatically copy the value of controls from the source to the destination. You specify this with nested <fr:map>
elements. They take the following required XML attributes:
left
: the name of the source (or "left") control
right
: the name of the destination (or "right") control
The synchronization takes place from "left" to "right":
Upon form initialization, unless you specified sync-on-form-load="none"
(see above), the iterations and values are enforced, which means:
Extra iterations in the destination are removed from the end if needed, to match the number of iterations in the source.
New iterations in the destination are added at the end if needed, to match the number of iterations in the source.
For each iteration, the values of controls specified with <fr:map>
are copied over.
When iterations are added in the source:
Corresponding iterations are added in the destination, at the same position.
When iterations are moved in the source:
Corresponding iterations are moved in the destination.
When iterations are removed in the source:
Corresponding iterations are removed in the destination.
When values of controls specified by <fr:map>
change in the source:
The values of the matching controls in the destination are updated.
The following example does the following:
Synchronize repeated iterations between repeated grid master-grid
and repeated section detail-section
.
For each iteration, copy over the value of the traveler-name
and traveler-birth-date
form controls.
The following screenshots show how the form looks like when using the wizard view:
[SINCE Orbeon Forms 2019.1]
When paging of large repeated sections is enabled, optionally with a repetition label, each master repetition appears as its own wizard page. This reduces the size of wizard pages and makes it easier to fill out a form.
With Orbeon Forms 2018.2, the <fr:synchronize-repeated-content>
has the following limitations:
The source grid or section must be visible for the synchronization to work. The destination, on the other hand, can be hidden.
Both repeated content must be at the top-level: they cannot be nested within other repeated sections.
Synchronization within section templates is not supported.
Simple Actions
Blog posts
sync-on-form-load
(optional): can be set to none
to disable right grid synchronization based on left grid on form load; disabling synchronization on load is a way to support having multiple lefts defined to synchronize with a single right, but only one left doing so at any given time, e.g. because the other lefts are irrelevant
Names are as you see them in the Form Builder user interface with the or dialogs.
Names are as you see them in the Form Builder user interface with the dialog.
See for detail of the configuration.