Comments? Feedback?

This wiki does not yet support public comments (a limitation of Google Sites), so we encourage you to post your comments either:

On Twitter by responding to @orbeon.

On our community mailing list: subscribe sending an email to ops-users-subscribe@ow2.org (content of subject/body doesn't matter), you'll get a response with the email to use to send your message to the community mailing list.

Recent site activity

Data-bound Select1


Overview

This components behaves very much like an <xforms:select1>, except that the data populating the control doesn't come from an instance, but from a service. You specify the URI of the service and the data-bound select1 component takes care of calling it when necessary, retrieving the data, and using that data to populate a drop-down, list, or radio buttons.

You can also use this component to create chained select1 controls, where the value selected in the first one drives the list of values available in the second one, and so on. The following example illustrates this situation.

Example

You need 3 drop-downs: state, city, and zip code. The state drop-down lists the 50 states, the city drop-down lists all the cities in the selected state, and the zip code drop-down lists all the zip codes for the selected city. This is the situation you see in the following screenshot:


To populate the state drop-down, you use a pre-existing service that returns the list of states.This service is at the URI /xforms-sandbox/service/zip-states. You specify that URI in the resource attribute. Other than that, the <fr:databound-select1> looks very much like an <xforms:select1>:

<fr:databound-select1 ref="state" appearance="minimal"
                      resource="/xforms-sandbox/service/zip-states">

    <xforms:label>State: </xforms:label>
    <xforms:itemset nodeset="/states/state">
        <xforms:label ref="@name"/>
        <xforms:value ref="@abbreviation"/>
    </xforms:itemset>
</fr:databound-select1>

So far so good: assuming you have such a service that returns the data you need, this component saves you from having to declare a submission to call the service, to declare an instance to store the data, and to call the service when appropriate. But things become more interesting when you chain another <fr:databound-select1>. Let's assume you have a service that returns the list cities for a state, taking that state as a parameter. As for the first drop-down, you specify the URI of that service in the resource attribute, and use an AVT to pass the value of the parameter. The component then takes care of calling the service whenever the parameter changes, to update the data as necessary.:

<fr:databound-select1 ref="city" appearance="minimal"
                      resource="/xforms-sandbox/service/zip-cities?state-abbreviation={state}">
    <xforms:label>City: </xforms:label>
    <xforms:itemset nodeset="/cities/city">
        <xforms:label ref="@name"/>
        <xforms:value ref="@name"/>
    </xforms:itemset>
</fr:databound-select1>

Using this technique, you can chain as many drop-downs (or lists, or radio buttons) as necessary, letting the component take care of calling the service when necessary. You can see the source of an example using 3 <fr:databound-select1> and producing the result shown in screenshot you've seen earlier.