Skip to content

Instantly share code, notes, and snippets.

@avernet
Last active August 29, 2015 14:10
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/d10caf619586a79b1a5e to your computer and use it in GitHub Desktop.
Save avernet/d10caf619586a79b1a5e to your computer and use it in GitHub Desktop.
<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>Untitled Form</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>
<autocomplete label=""/>
<radio/>
<output/>
</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="autocomplete-bind" ref="autocomplete" name="autocomplete"/>
<xf:bind id="radio-bind" ref="radio" name="radio"/>
<xf:bind id="output-bind" ref="output" name="output" calculate="$autocomplete"/>
</xf:bind>
</xf:bind>
<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">Untitled Form</title>
<description xml:lang="en"/>
<singleton>false</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">
<autocomplete>
<label>Country autocomplete</label>
<hint/>
</autocomplete>
<radio>
<label>Country radio</label>
<hint/>
<item>
<label>Switzerland</label>
<hint/>
<value>Switzerland</value>
</item>
<item>
<label>United States</label>
<hint/>
<value>United States</value>
</item>
</radio>
<output>
<label>Value for autocomplete</label>
<hint/>
</output>
<section-1>
<label>Country</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:action ev:event="xforms-value-changed" ev:observer="radio-control">
<xf:var name="value" value="xxf:value('radio-control')"/>
<xf:dispatch target="autocomplete-control" name="fr-set-label">
<xf:property name="label" value="$value"/>
</xf:dispatch>
</xf:action>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:xbl="http://www.w3.org/ns/xbl">
<fr:section id="section-1-control" bind="section-1-bind">
<xf:label ref="$form-resources/section-1/label"/>
<fr:grid>
<xh:tr>
<xh:td>
<fr:autocomplete xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
id="autocomplete-control"
appearance="minimal"
labelref="@label"
resource="/fr/service/custom/orbeon/controls/countries?country-name={$fr-search-value}"
bind="autocomplete-bind">
<xf:label ref="$form-resources/autocomplete/label"/>
<xf:hint ref="$form-resources/autocomplete/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:itemset ref="/countries/country">
<xf:label ref="name"/>
<xf:value ref="us-code"/>
</xf:itemset>
</fr:autocomplete>
</xh:td>
<xh:td>
<xf:select1 id="radio-control" appearance="full" bind="radio-bind">
<xf:label ref="$form-resources/radio/label"/>
<xf:hint ref="$form-resources/radio/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:itemset ref="$form-resources/radio/item">
<xf:label ref="label"/>
<xf:value ref="value"/>
<xf:hint ref="hint"/>
</xf:itemset>
</xf:select1>
</xh:td>
</xh:tr>
<xh:tr>
<xh:td>
<xf:output id="output-control" bind="output-bind">
<xf:label ref="$form-resources/output/label"/>
<xf:hint ref="$form-resources/output/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:output>
</xh:td>
<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