How to create an XBL control that saves data in two elements?

I'm trying to tell Orbeon to group 2 fields together in order to capture 2 values as in: Pounds & Ounces.

<xs:complexType name="rpm-weight">
    <xs:sequence>
        <xs:element name="weight-lbs" type="rpm-weight-lbs" minOccurs="1" maxOccurs="1"/>
        <xs:element name="weight-oz" type="rpm-weight-oz"   minOccurs="1" maxOccurs="1">
    </xs:sequence>
</xs:complexType>

How can I tell Orbeon that when selecting rpm-weight, it will generate 2 text boxes?

Answers


Creating an XBL component is the way to go, which might be tricky if this is the first time you're doing this. A few pointers:

  • So you can use it in Form Builder, your component needs to bind to one element (with ref). The name of the element will be the name given by form authors to the control in Form Builder (assuming they're not using a custom instance).
  • Form Builder will create one element in the instance for the control. Since your control needs to have sub-elements, you need to tell Form Builder about those. You can do that using the fb:metadata/fb:template/fb:instance. See for instance how this is done in autocomplete.xbl. E.g. that part of the metadata will look as follows.

Example Form Builder metadata for the XBL:

<fb:metadata xmlns:fb="http://orbeon.org/oxf/xml/form-builder">
    ...
    <fb:templates>
        <fb:instance>
            <weight-lbs/>
            <weight-oz/>
        </fb:instance>
        <fb:view>
            ...
       </fb:view>
    </fb:templates>
</fb:metadata>

Need Your Help

DataAnnotations in MVC4

asp.net-mvc

I am try to use DataAnnotation Required in MVC4 with ErrorMessageResourceType and ErrorMessageResourceName like this

Fastest way to store table of data and retrieve

php mysql database arrays serialization

I am storing some history information on my website for future retrieval of the users. So when they visit certain pages it will record the page that they visited, the time, and then store it under...