Skip to content

Instantly share code, notes, and snippets.

@avernet
Created May 3, 2014 01:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avernet/21b5ddf36ce6003985fb to your computer and use it in GitHub Desktop.
Save avernet/21b5ddf36ce6003985fb to your computer and use it in GitHub Desktop.
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:exf="http://www.exforms.org/exf/1-0"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:saxon="http://saxon.sf.net/"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder">
<xh:head>
<xh:title>Data-bound drop-down</xh:title>
<xh:style type="text/css">
.orbeon .fr-itemset-empty-true { display: none }
</xh:style>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true">
<!-- Main instance -->
<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all">
<form>
<state-city-zip>
<state itemset-empty="false"/>
<city itemset-empty="true"/>
<zip itemset-empty="true"/>
</state-city-zip>
</form>
</xf:instance>
<!-- Bindings -->
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="state-city-zip-bind" name="state-city-zip" ref="state-city-zip">
<xf:bind id="state-bind" ref="state" name="state" required="true()"/>
<xf:bind id="city-bind" ref="city" name="city"
fr:itemset-empty="@itemset-empty = 'true'"
required="@itemset-empty = 'false'"/>
<xf:bind id="zip-bind" ref="zip" name="zip" fr:itemset-empty="@itemset-empty = 'true'"
required="@itemset-empty = 'false'"/>
</xf:bind>
</xf:bind>
<!-- Metadata -->
<xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>a</application-name>
<form-name>a</form-name>
<title xml:lang="en">Data-bound drop-down</title>
<description xml:lang="en"/>
</metadata>
</xf:instance>
<!-- Attachments -->
<xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all">
<attachments>
<css mediatype="text/css" filename="" size=""/>
<pdf mediatype="application/pdf" filename="" size=""/>
</attachments>
</xf:instance>
<!-- All form resources -->
<!-- Don't make readonly by default in case a service modifies the resources -->
<xf:instance id="fr-form-resources" xxf:readonly="false" xxf:exclude-result-prefixes="#all">
<resources>
<resource xml:lang="en">
<state>
<label>State</label>
<hint/>
</state>
<city>
<label>City</label>
<hint/>
</city>
<zip>
<label>Zip</label>
<hint/>
</zip>
<state-city-zip>
<label>State, City, Zip</label>
</state-city-zip>
</resource>
</resources>
</xf:instance>
<!-- Utility instances for services -->
<xf:instance id="fr-service-request-instance" xxf:exclude-result-prefixes="#all">
<request/>
</xf:instance>
<xf:instance id="fr-service-response-instance" xxf:exclude-result-prefixes="#all">
<response/>
</xf:instance>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:xbl="http://www.w3.org/ns/xbl"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:p="http://www.orbeon.com/oxf/pipeline">
<fr:section id="state-city-zip-control" bind="state-city-zip-bind">
<xf:label ref="$form-resources/state-city-zip/label"/>
<fr:grid>
<xh:tr>
<xh:td>
<fr:databound-select1 xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" id="state-control"
appearance="minimal"
resource="/xforms-sandbox/service/zip-states"
bind="state-bind">
<xf:label ref="$form-resources/state/label"/>
<xf:hint ref="$form-resources/state/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:itemset ref="/states/state">
<xf:label ref="@name"/>
<xf:value ref="@abbreviation"/>
</xf:itemset>
</fr:databound-select1>
</xh:td>
<xh:td>
<fr:databound-select1 xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" id="city-control" appearance="minimal"
resource="/xforms-sandbox/service/zip-cities?state-abbreviation={../state}"
bind="city-bind">
<xf:label ref="$form-resources/city/label"/>
<xf:hint ref="$form-resources/city/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:itemset ref="/cities/city">
<xf:label ref="@name"/>
<xf:value ref="@name"/>
</xf:itemset>
</fr:databound-select1>
</xh:td>
<xh:td>
<fr:databound-select1 xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" id="zip-control" appearance="minimal"
resource="/xforms-sandbox/service/zip-zips?state-abbreviation={../state}&amp;city={../city}"
bind="zip-bind">
<xf:label ref="$form-resources/zip/label"/>
<xf:hint ref="$form-resources/zip/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:itemset ref="/zips/zip">
<xf:label ref="@code"/>
<xf:value ref="@code"/>
</xf:itemset>
</fr:databound-select1>
</xh:td>
</xh:tr>
</fr:grid>
</fr:section>
</fr:body>
</fr:view>
</xh:body>
</xh:html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment