Skip to content

Instantly share code, notes, and snippets.

@hoila
Created November 13, 2017 22:26
Show Gist options
  • Save hoila/989563d499d6dbef1a7edda14338dff5 to your computer and use it in GitHub Desktop.
Save hoila/989563d499d6dbef1a7edda14338dff5 to your computer and use it in GitHub Desktop.
orbeon: to reproduce the stay or leave popup window
<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"
fr:data-format-version="4.0.0">
<xh:head>
<xh:title>Untitled Form</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" xxf:index="id">
<form>
<section-1>
<control-2/>
</section-1>
<section-4>
<datenOK>false</datenOK>
</section-4>
</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"
readonly="$datenOK =true()">
<xf:bind id="control-2-bind" ref="control-2" name="control-2"/>
</xf:bind>
<xf:bind id="section-4-bind" ref="section-4" name="section-4">
<xf:bind id="datenOK-bind" ref="datenOK" name="datenOK" type="xf:boolean"
readonly="true()"/>
</xf:bind>
</xf:bind>
<!-- Metadata -->
<xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>apptest</application-name>
<form-name>stay_or_leave</form-name>
<title xml:lang="en">Untitled Form</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 -->
<xf:instance xxf:readonly="true" id="fr-form-resources" xxf:exclude-result-prefixes="#all">
<resources>
<resource xml:lang="en">
<control-2>
<label>choice</label>
<hint/>
</control-2>
<datenOK>
<label>The data entered are correct? </label>
<hint>This field is readonly. Clicking the FINISH button the value changes to yes and you cannot change furthermore any data</hint>
</datenOK>
<section-1>
<label>Untitled Section</label>
</section-1>
<section-4>
<label>End of form</label>
<help/>
</section-4>
</resource>
</resources>
</xf:instance>
<xf:instance id="loadchoices-instance" class="fr-database-service"
xxf:exclude-result-prefixes="#all">
<body xmlns:fbf="java:org.orbeon.oxf.fb.FormBuilder"
xmlns:secure="java:org.orbeon.oxf.util.SecureUtils"
xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:frf="java:org.orbeon.oxf.fr.FormRunner">&lt;sql:config xmlns:sql="http://orbeon.org/oxf/xml/sql"&gt;
&lt;sql:datasource&gt;oracle&lt;/sql:datasource&gt;
&lt;sql:query&gt;SELECT label, value FROM test.choices &lt;/sql:query&gt;
&lt;/sql:config&gt;</body>
</xf:instance>
<xf:submission id="loadchoices-submission" class="fr-database-service"
resource="/fr/service/custom/orbeon/database"
method="post"
serialization="application/xml"/>
<xf:action id="choices_action-binding">
<xf:action event="fr-run-form-load-action-after-controls" ev:observer="fr-form-model"
if="true()">
<xf:send submission="loadchoices-submission"/>
</xf:action>
<xf:action event="xforms-submit" ev:observer="loadchoices-submission">
<xf:var name="request-instance-name" value="'loadchoices-instance'"/>
<xf:action/>
</xf:action>
<xf:action event="xforms-submit-done" ev:observer="loadchoices-submission">
<xf:action class="fr-itemset-action">
<xf:var name="control-name" value="'control-2'"/>
<xf:var name="response-items" value="/response/row"/>
<xf:var name="item-label" value="label"/>
<xf:var name="item-value" value="value"/>
</xf:action>
</xf:action>
</xf:action>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:xbl="http://www.w3.org/ns/xbl"
xmlns:oxf="http://www.orbeon.com/oxf/processors">
<fr:section id="section-1-control" bind="section-1-bind">
<xf:label ref="$form-resources/section-1/label"/>
<fr:grid>
<xh:tr>
<xh:td>
<xf:select1 id="control-2-control" bind="control-2-bind" appearance="dropdown">
<xf:label ref="$form-resources/control-2/label"/>
<xf:hint ref="$form-resources/control-2/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:itemset ref="$form-resources/control-2/item">
<xf:label ref="label"/>
<xf:value ref="value"/>
</xf:itemset>
</xf:select1>
</xh:td>
<xh:td/>
</xh:tr>
</fr:grid>
</fr:section>
<fr:section id="section-4-control" bind="section-4-bind">
<xf:label ref="$form-resources/section-4/label"/>
<fr:grid>
<xh:tr>
<xh:td>
<fr:yesno-input xmlns="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
id="datenOK-control"
bind="datenOK-bind">
<xf:label ref="$form-resources/datenOK/label"/>
<xf:hint ref="$form-resources/datenOK/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</fr:yesno-input>
</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