Projects‎ > ‎

Optional content in Form Runner

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


NOTE: As of 2010-06-14, this is an ongoing project and not a feature of Form Runner / Form Builder.

Rationale

Forms often need optional content. For example:
  • a shipping address might be present only if different from a billing address
  • some information only makes sense if a checkbox is ticked
The Orbeon Forms XForms engine already supports this feature in several ways, including using relevance, repeats, and inserting templates.

Form Runner and Form Builder, on the other hand, need this feature exposed in a form author-friendly way, following a standard pattern. This project explores some possibilities.

Options

Custom, using controls and relevance

Idea:
  • use a checkbox or button placed in the UI
  • use a relevant constraint to show/hide the content
Benefits:
  • don't need any new functionality in Form Runner / Builder
  • customizable
Drawbacks:
  • more work for the form author
  • less declarative

Possibility: use <fr:grid repeat="true">

Form Runner supports an <fr:grid> component under <fr:section> which supports a repeat="true" attribute.

NOTE: This used to be <fr:repeat>, but that has been deprecated as of the summer 2011.

One idea is to use this the special case of min=0, max=1 to show a different appearance, e.g.:

<fr:section ... bind="addresses-bind">
    <fr:grid repeat="true" bind="shipping-address" minOccurs="0" maxOccurs="1" ...>
        ...

NOTE: <fr:grid repeat="true"> requires a nested element in the data model, e.g.:

<addresses>
    <shipping-address>
        <street>...</street>

[TODO: UI mockup]

Benefits:
  • works like / extends current <fr:grid repeat="true">
  • can mix with other <fr:grid> within same section
Drawbacks;
  • ?

Optional section

Here, the entire section can be made optional, e.g.:

<fr:section ... bind="addresses-bind" optional="true">

or:

<fr:section ... bind="addresses-bind" minOccurs="0" maxOccurs="1">

Open questions:
  • how to make the data in the instance non-relevant?
  • we don't want to use @bind and to make the whole section data non-relevant, as the semantic would be that the section component itself would be entirely hidden
    • -> so we want to make only the content of the section element non-relevant?

[TODO: UI mockup]

NOTE: We don't want to use the open/close of the section to indicate presence/absence: that would be confusing to the user.

Comments