Created
March 18, 2021 22:03
-
-
Save orbeon/1e25851b7219f765a2cde373a72e9dea to your computer and use it in GitHub Desktop.
Fields pre-population
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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:map="http://www.w3.org/2005/xpath-functions/map" | |
xmlns:array="http://www.w3.org/2005/xpath-functions/array" | |
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>Employee evaluation</xh:title> | |
<xf:model id="fr-form-model" xxf:expose-xpath-types="true" xxf:analysis.calculate="true"> | |
<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all" xxf:index="id"> | |
<form> | |
<internal> | |
<grid-2> | |
<employee-id/> | |
</grid-2> | |
</internal> | |
<section-1> | |
<grid-1> | |
<first-name/> | |
<last-name/> | |
<hire-date/> | |
<department/> | |
</grid-1> | |
</section-1> | |
</form> | |
</xf:instance> | |
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')"> | |
<xf:bind id="internal-bind" ref="internal" name="internal"> | |
<xf:bind id="grid-2-bind" ref="grid-2" name="grid-2"> | |
<xf:bind id="employee-id-bind" ref="employee-id" name="employee-id" | |
xxf:default="xxf:get-request-parameter('employee-id')"/> | |
</xf:bind> | |
</xf:bind> | |
<xf:bind id="section-1-bind" name="section-1" ref="section-1"> | |
<xf:bind id="grid-1-bind" ref="grid-1" name="grid-1"> | |
<xf:bind id="first-name-bind" name="first-name" ref="first-name" xxf:whitespace="trim"/> | |
<xf:bind id="last-name-bind" ref="last-name" name="last-name" xxf:whitespace="trim"/> | |
<xf:bind id="hire-date-bind" ref="hire-date" name="hire-date" type="xf:date"/> | |
<xf:bind id="department-bind" ref="department" name="department"/> | |
</xf:bind> | |
</xf:bind> | |
</xf:bind> | |
<xf:instance id="fr-form-metadata" xxf:readonly="true" xxf:exclude-result-prefixes="#all"> | |
<metadata> | |
<application-name>hr</application-name> | |
<form-name>employee</form-name> | |
<title xml:lang="en">Employee evaluation</title> | |
<description xml:lang="en"/> | |
<created-with-version>2020.1.2.202103042356 PE</created-with-version> | |
<updated-with-version>2020.1.2.202103042356 PE</updated-with-version> | |
<library-versions> | |
<orbeon>8</orbeon> | |
</library-versions> | |
</metadata> | |
</xf:instance> | |
<xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all"> | |
<attachments/> | |
</xf:instance> | |
<xf:instance xxf:readonly="true" id="fr-form-resources" xxf:exclude-result-prefixes="#all"> | |
<resources> | |
<resource xml:lang="en"> | |
<employee-id> | |
<label>Employee id</label> | |
<hint/> | |
</employee-id> | |
<section-1> | |
<label>Employee</label> | |
</section-1> | |
<first-name> | |
<label>First name</label> | |
<hint/> | |
</first-name> | |
<last-name> | |
<label>Last name</label> | |
<hint/> | |
</last-name> | |
<hire-date> | |
<label>Hire date</label> | |
<hint/> | |
</hire-date> | |
<department> | |
<label>Department</label> | |
<hint/> | |
<item> | |
<label>Administration</label> | |
<value>1</value> | |
</item> | |
<item> | |
<label>Marketing</label> | |
<value>2</value> | |
</item> | |
<item> | |
<label>Purchasing</label> | |
<value>3</value> | |
</item> | |
<item> | |
<label>Human Resources</label> | |
<value>4</value> | |
</item> | |
<item> | |
<label>Shipping</label> | |
<value>5</value> | |
</item> | |
<item> | |
<label>IT</label> | |
<value>6</value> | |
</item> | |
<item> | |
<label>Public Relations</label> | |
<value>7</value> | |
</item> | |
<item> | |
<label>Sales</label> | |
<value>8</value> | |
</item> | |
<item> | |
<label>Executive</label> | |
<value>9</value> | |
</item> | |
<item> | |
<label>Finance</label> | |
<value>10</value> | |
</item> | |
<item> | |
<label>Accounting</label> | |
<value>11</value> | |
</item> | |
</department> | |
<internal> | |
<label>(Internal)</label> | |
</internal> | |
</resource> | |
</resources> | |
</xf:instance> | |
<xf:instance id="employee-info-instance" class="fr-database-service" | |
xxf:exclude-result-prefixes="#all"> | |
<body xmlns:process="java:org.orbeon.oxf.fr.process.SimpleProcess" xmlns:d="DAV:" | |
xmlns:secure="java:org.orbeon.oxf.util.SecureUtils" | |
xmlns:p="http://www.orbeon.com/oxf/pipeline" | |
xmlns:frf="java:org.orbeon.oxf.fr.FormRunner"><sql:config xmlns:sql="http://orbeon.org/oxf/xml/sql"> | |
<sql:datasource>mysql_demo</sql:datasource> | |
<sql:query>SELECT * | |
FROM employees | |
WHERE employee_id = <sql:param type="xs:string" select=""/> | |
</sql:query> | |
</sql:config></body> | |
</xf:instance> | |
<xf:submission id="employee-info-submission" class="fr-database-service" | |
resource="/fr/service/custom/orbeon/database" | |
method="post" | |
serialization="application/xml"/> | |
<xf:action id="fill-employee-binding"> | |
<xf:action event="fr-run-form-load-action-after-controls" ev:observer="fr-form-model" | |
if="true()"> | |
<xf:send submission="employee-info-submission"/> | |
</xf:action> | |
<xf:action event="xforms-submit" ev:observer="employee-info-submission"> | |
<xf:var name="request-instance-name" value="'employee-info-instance'"/> | |
<xf:action> | |
<xf:action class="fr-set-database-service-value-action"> | |
<xf:var name="control-name" value="'employee-id'"/> | |
<xf:var name="parameter" value="1"/> | |
</xf:action> | |
</xf:action> | |
</xf:action> | |
<xf:action event="xforms-submit-done" ev:observer="employee-info-submission"> | |
<xf:action class="fr-set-control-value-action"> | |
<xf:var name="control-name" value="'first-name'"/> | |
<xf:var name="control-value" value="/response/row/first-name"/> | |
</xf:action> | |
<xf:action class="fr-set-control-value-action"> | |
<xf:var name="control-name" value="'last-name'"/> | |
<xf:var name="control-value" value="/response/row/last-name"/> | |
</xf:action> | |
<xf:action class="fr-set-control-value-action"> | |
<xf:var name="control-name" value="'hire-date'"/> | |
<xf:var name="control-value" value="/response/row/hire-date"/> | |
</xf:action> | |
<xf:action class="fr-set-control-value-action"> | |
<xf:var name="control-name" value="'department'"/> | |
<xf:var name="control-value" value="/response/row/department-id"/> | |
</xf:action> | |
</xf:action> | |
</xf:action> | |
</xf:model> | |
</xh:head> | |
<xh:body> | |
<fr:view> | |
<fr:body xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:p="http://www.orbeon.com/oxf/pipeline" | |
xmlns:oxf="http://www.orbeon.com/oxf/processors"> | |
<fr:section id="internal-section" bind="internal-bind"> | |
<xf:label ref="$form-resources/internal/label"/> | |
<fr:grid id="grid-2-grid" bind="grid-2-bind"> | |
<fr:c x="1" y="1" w="3"> | |
<xf:output id="employee-id-control" bind="employee-id-bind"> | |
<xf:label ref="$form-resources/employee-id/label"/> | |
<xf:hint ref="$form-resources/employee-id/hint"/> | |
<xf:alert ref="$fr-resources/detail/labels/alert"/> | |
</xf:output> | |
</fr:c> | |
<fr:c x="4" y="1" w="9"/> | |
</fr:grid> | |
</fr:section> | |
<fr:section id="section-1-section" bind="section-1-bind"> | |
<xf:label ref="$form-resources/section-1/label"/> | |
<fr:grid id="grid-1-grid" bind="grid-1-bind"> | |
<fr:c y="1" x="1" w="3"> | |
<xf:input id="first-name-control" bind="first-name-bind"> | |
<xf:label ref="$form-resources/first-name/label"/> | |
<xf:hint ref="$form-resources/first-name/hint"/> | |
<xf:alert ref="$fr-resources/detail/labels/alert"/> | |
</xf:input> | |
</fr:c> | |
<fr:c y="1" x="4" w="3"> | |
<xf:input id="last-name-control" bind="last-name-bind"> | |
<xf:label ref="$form-resources/last-name/label"/> | |
<xf:hint ref="$form-resources/last-name/hint"/> | |
<xf:alert ref="$fr-resources/detail/labels/alert"/> | |
</xf:input> | |
</fr:c> | |
<fr:c x="7" y="1" w="3" h="1"> | |
<fr:date xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" | |
xmlns:DateSupport="java:org.orbeon.xbl.DateSupportJava" | |
id="hire-date-control" | |
bind="hire-date-bind"> | |
<xf:label ref="$form-resources/hire-date/label"/> | |
<xf:hint ref="$form-resources/hire-date/hint"/> | |
<xf:alert ref="$fr-resources/detail/labels/alert"/> | |
</fr:date> | |
</fr:c> | |
<fr:c x="10" y="1" w="3" h="1"> | |
<xf:select1 id="department-control" bind="department-bind" appearance="dropdown"> | |
<xf:label ref="$form-resources/department/label"/> | |
<xf:hint ref="$form-resources/department/hint"/> | |
<xf:alert ref="$fr-resources/detail/labels/alert"/> | |
<xf:itemset ref="$form-resources/department/item"> | |
<xf:label ref="label"/> | |
<xf:value ref="value"/> | |
</xf:itemset> | |
</xf:select1> | |
</fr:c> | |
</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