Data Models

NOTE: This page describes an Orbeon Forms project, not a feature which is currently part of Orbeon Forms.


Form Builder can be made aware of "data models" at design time.

These data models can describe:
  • the form data to capture
  • secondary data models, which an provide data useful during form initialization, calculations, etc.
Form Runner, at runtime, can be passed concrete data to initialize these data models.


Binding of initial control data

Assume a set of initial data known at runtime, containing name → value mappings.

At design time, the form author wants to specify that the initial value of certain controls comes from these mappings.

For example, the user's personal information such as name, birth date, etc. might be used to pre-populate certain fields of the form.

The form author can specify, as initial data, data coming from a secondary data model, by selecting a name from a list.

Other scenarios



Primary data model

This is the data model into which data entered by the user is captured.


  • XForms instance called "fr-form-instance"
  • created dynamically as user interacts with FB
  • internally addressed by element name, assuming every name is unique
For now, we keep the primary data model as is. Later, the same mechanism used for loading initial data of secondary data models can be used to load initial data of the primary data model.

Secondary data models

These are (tentatively read-only) data models providing accessory data to the form.

Currently: non-existing, except by the use of services or custom code.

Form Builder

At design time:
  1. FB is made aware of the existence of secondary data models
    • data models can be set into the request or session, OR POST-ed to the /new page (POST is harder if there are multiple data models)
    • a data model consists of an XML template document
    • tentatively: the template is placed within an envelope
  2. FB has a user interface allowing selection from the secondary data models
    • IF one or more secondary data models is present, the user interface proposes an additional way of selecting (at least) controls initial data
    • for now, propose all leaf elements in data model
  3. At XForms level:
    • secondary data models are stored as separate instances, e.g. fr-dm-foobar, where "foobar" is the name provided for the external data model in the instance/session
    • initial data is implemented as binds, e.g. <xf:bind ref="/form/section/first-name" xxf:default="instance('fr-dm-foobar')/a/b/first-name"/>

Form Runner

At runtime:
  • Form is aware of secondary data models since they are in definitions
  • Initial values for the secondary model instances can be set by properties in request/session (later: services)
  • xf:bind does the rest!