Skip to content

Instantly share code, notes, and snippets.

@avernet
Last active August 29, 2015 14:09
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/ab9d87b8811a396cdc76 to your computer and use it in GitHub Desktop.
Save avernet/ab9d87b8811a396cdc76 to your computer and use it in GitHub Desktop.
Sample for "dropdown from form control"
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:saxon="http://saxon.sf.net/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:exf="http://www.exforms.org/exf/1-0">
<xh:head>
<xh:title>Support levels</xh:title>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true">
<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all">
<form>
<section-1>
<itemset>
<label>Basic Dev Support</label>
<value>basic</value>
<price>4300.00</price>
</itemset>
<itemset>
<label>Silver Dev Support</label>
<value>silver</value>
<price>9500.00</price>
</itemset>
<itemset>
<label>Gold Dev Support</label>
<value>gold</value>
<price>17000.00</price>
</itemset>
<itemset>
<label>Platinum Dev Support</label>
<value>platinum</value>
<price>30000</price>
</itemset>
</section-1>
</form>
</xf:instance>
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="section-1-bind" name="section-1" ref="section-1">
<xf:bind id="itemset-bind" ref="itemset" name="itemset">
<xf:bind id="label-bind" ref="label" name="label"/>
<xf:bind id="value-bind" ref="value" name="value"/>
<xf:bind id="price-bind" ref="price" name="price" type="xf:decimal"/>
</xf:bind>
</xf:bind>
</xf:bind>
<xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>support</application-name>
<form-name>level</form-name>
<title xml:lang="en">Support levels</title>
<description xml:lang="en"/>
<singleton>true</singleton>
</metadata>
</xf:instance>
<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>
<xf:instance id="fr-form-resources" xxf:readonly="false" xxf:exclude-result-prefixes="#all">
<resources>
<resource xml:lang="en">
<label>
<label>Level</label>
<hint/>
</label>
<value>
<label>Value</label>
<hint/>
</value>
<price>
<label>Price</label>
<hint/>
</price>
<section-1>
<label>Untitled Section</label>
</section-1>
</resource>
</resources>
</xf:instance>
<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:instance xxf:readonly="true" id="itemset-template">
<itemset>
<label/>
<value/>
<price/>
</itemset>
</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="section-1-control" bind="section-1-bind">
<xf:label ref="$form-resources/section-1/label"/>
<fr:grid id="itemset-control" repeat="true" bind="itemset-bind"
template="instance('itemset-template')"
min="1">
<xh:tr>
<xh:td>
<xf:input id="label-control" bind="label-bind">
<xf:label ref="$form-resources/label/label"/>
<xf:hint ref="$form-resources/label/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
</xh:td>
<xh:td>
<xf:input id="value-control" bind="value-bind">
<xf:label ref="$form-resources/value/label"/>
<xf:hint ref="$form-resources/value/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
</xh:td>
<xh:td>
<fr:currency xmlns="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
id="price-control"
bind="price-bind">
<xf:label ref="$form-resources/price/label"/>
<xf:hint ref="$form-resources/price/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</fr:currency>
</xh:td>
</xh:tr>
</fr:grid>
</fr:section>
</fr:body>
</fr:view>
</xh:body>
</xh:html>
<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>Subscribe to support</xh:title>
<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>
<section-1>
<level/>
<price/>
</section-1>
</form>
</xf:instance>
<!-- Bindings -->
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="section-1-bind" name="section-1" ref="section-1">
<xf:bind id="level-bind" ref="level" name="level"/>
<xf:bind id="price-bind" ref="price" name="price" type="xf:decimal" readonly="true()"
calculate="$level/@price"/>
</xf:bind>
</xf:bind>
<!-- Metadata -->
<xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>support</application-name>
<form-name>subscribe</form-name>
<title xml:lang="en">Subscribe to support</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">
<level>
<label>Level</label>
<hint/>
</level>
<price>
<label>Price</label>
<hint/>
</price>
<section-1>
<label>Support</label>
</section-1>
</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="section-1-control" bind="section-1-bind">
<xf:label ref="$form-resources/section-1/label"/>
<fr:grid>
<xh:tr>
<xh:td>
<allianz:dropdown-from-form xmlns:allianz="http://www.allianz.com.au/"
xmlns="http://orbeon.org/oxf/xml/form-builder"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
app="support"
form="level"
id="level-control"
bind="level-bind">
<xf:label ref="$form-resources/level/label"/>
<xf:hint ref="$form-resources/level/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</allianz:dropdown-from-form>
</xh:td>
<xh:td>
<fr:currency xmlns="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
id="price-control"
bind="price-bind">
<xf:label ref="$form-resources/price/label"/>
<xf:hint ref="$form-resources/price/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</fr:currency>
</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