Insert a record at the top of a repeatable section (as opposed to the bottom)
Create a Button (trigger) example, where CALIBRATION_EQUIP_LOG_ACTIVITY is the repeating section name
<xf:trigger id="CALIBRATION_EQUIP_LOG_ADD-control" bind="CALIBRATION_EQUIP_LOG_ADD-bind">
<xf:label ref="$form-resources/CALIBRATION_EQUIP_LOG_ADD/label"/>
<xf:hint ref="$form-resources/CALIBRATION_EQUIP_LOG_ADD/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:insert ev:event="DOMActivate" context="../../CALIBRATION_EQUIP_LOG_ACTIVITY"
ref="CALIBRATION_EQUIP_LOG_ACTIVITY"
at="1"
postion="before"
origin="instance('CALIBRATION_EQUIP_LOG_ACTIVITY-template')"/>
</xf:trigger>
Full XHTML:
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xi="http://www.w3.org/2001/XInclude"
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>Equipment Log</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>
<CALIBRATION_EQUIP_LOG_DETAILS>
<SYS_BUSINESS_NUMBER/>
<CALIBRATION_EQUIP_LOG_ACTIVE/>
<CALIBRATION_EQUIP_LOG_RECORD_LINK/>
<CALIBRATION_EQUIP_LOG_NUMBER/>
<CALIBRATION_EQUIP_LOG_NAME/>
<CALIBRATION_EQUIP_LOG_CATEGORY/>
<CALIBRATION_EQUIP_LOG_ADD/>
</CALIBRATION_EQUIP_LOG_DETAILS>
<CALIBRATION_EQUIP_LOG_ACTIVITY>
<CALIBRATION_EQUIP_LOG_ACTIVITY-iteration>
<CALIBRATION_EQUIP_LOG_ACTIVITY_DATE/>
<CALIBRATION_RECORD_PERFORM_BY/>
<CALIBRATION_EQUIP_LOG_ACTIVITY_NOTES/>
<CALIBRATION_EQUIP_LOG_ACTIVITY_ATTACH filename="" mediatype="" size=""/>
</CALIBRATION_EQUIP_LOG_ACTIVITY-iteration>
</CALIBRATION_EQUIP_LOG_ACTIVITY>
</form>
</xf:instance>
<!-- Bindings -->
<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="CALIBRATION_EQUIP_LOG_DETAILS-bind" name="CALIBRATION_EQUIP_LOG_DETAILS"
ref="CALIBRATION_EQUIP_LOG_DETAILS">
<xf:bind id="SYS_BUSINESS_NUMBER-bind" name="SYS_BUSINESS_NUMBER"
ref="SYS_BUSINESS_NUMBER"/>
<xf:bind id="CALIBRATION_EQUIP_LOG_ACTIVE-bind" ref="CALIBRATION_EQUIP_LOG_ACTIVE"
name="CALIBRATION_EQUIP_LOG_ACTIVE"
type="xf:boolean"/>
<xf:bind id="CALIBRATION_EQUIP_LOG_RECORD_LINK-bind"
ref="CALIBRATION_EQUIP_LOG_RECORD_LINK"
name="CALIBRATION_EQUIP_LOG_RECORD_LINK"/>
<xf:bind id="CALIBRATION_EQUIP_LOG_CATEGORY-bind" ref="CALIBRATION_EQUIP_LOG_CATEGORY"
name="CALIBRATION_EQUIP_LOG_CATEGORY"/>
<xf:bind id="CALIBRATION_EQUIP_LOG_NAME-bind" ref="CALIBRATION_EQUIP_LOG_NAME"
name="CALIBRATION_EQUIP_LOG_NAME"/>
<xf:bind id="CALIBRATION_EQUIP_LOG_NUMBER-bind" ref="CALIBRATION_EQUIP_LOG_NUMBER"
name="CALIBRATION_EQUIP_LOG_NUMBER"/>
<xf:bind id="CALIBRATION_EQUIP_LOG_ADD-bind" ref="CALIBRATION_EQUIP_LOG_ADD"
name="CALIBRATION_EQUIP_LOG_ADD"/>
</xf:bind>
<xf:bind id="CALIBRATION_EQUIP_LOG_ACTIVITY-bind" ref="CALIBRATION_EQUIP_LOG_ACTIVITY"
name="CALIBRATION_EQUIP_LOG_ACTIVITY">
<xf:bind id="CALIBRATION_EQUIP_LOG_ACTIVITY-iteration-bind"
ref="CALIBRATION_EQUIP_LOG_ACTIVITY-iteration"
name="CALIBRATION_EQUIP_LOG_ACTIVITY-iteration">
<xf:bind id="CALIBRATION_EQUIP_LOG_ACTIVITY_DATE-bind"
ref="CALIBRATION_EQUIP_LOG_ACTIVITY_DATE"
name="CALIBRATION_EQUIP_LOG_ACTIVITY_DATE"
type="xf:date"/>
<xf:bind id="CALIBRATION_RECORD_PERFORM_BY-bind" ref="CALIBRATION_RECORD_PERFORM_BY"
name="CALIBRATION_RECORD_PERFORM_BY"/>
<xf:bind id="CALIBRATION_EQUIP_LOG_ACTIVITY_ATTACH-bind"
ref="CALIBRATION_EQUIP_LOG_ACTIVITY_ATTACH"
name="CALIBRATION_EQUIP_LOG_ACTIVITY_ATTACH"
type="xf:anyURI"/>
<xf:bind id="CALIBRATION_EQUIP_LOG_ACTIVITY_NOTES-bind"
ref="CALIBRATION_EQUIP_LOG_ACTIVITY_NOTES"
name="CALIBRATION_EQUIP_LOG_ACTIVITY_NOTES"/>
</xf:bind>
</xf:bind>
</xf:bind>
<!-- Metadata -->
<xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>CALIBRATION</application-name>
<form-name>EQUIPMENT_LOG</form-name>
<title xml:lang="en">Equipment Log</title>
<description xml:lang="en"/>
<singleton>false</singleton>
</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">
<CALIBRATION_EQUIP_LOG_ACTIVITY_DATE>
<label>Date</label>
<hint/>
</CALIBRATION_EQUIP_LOG_ACTIVITY_DATE>
<CALIBRATION_RECORD_PERFORM_BY>
<label>Completed by</label>
<hint/>
<item>
<label>First choice</label>
<value>1</value>
</item>
<item>
<label>Second choice</label>
<value>2</value>
</item>
<item>
<label>Third choice</label>
<value>3</value>
</item>
</CALIBRATION_RECORD_PERFORM_BY>
<CALIBRATION_EQUIP_LOG_ACTIVITY_NOTES>
<label>Activity Notes</label>
<hint/>
</CALIBRATION_EQUIP_LOG_ACTIVITY_NOTES>
<CALIBRATION_EQUIP_LOG_ACTIVITY_ATTACH>
<label>Attachments</label>
<hint/>
</CALIBRATION_EQUIP_LOG_ACTIVITY_ATTACH>
<CALIBRATION_EQUIP_LOG_DETAILS>
<label>Equipment Details</label>
</CALIBRATION_EQUIP_LOG_DETAILS>
<CALIBRATION_EQUIP_LOG_ACTIVITY>
<label>Activity Log</label>
<help/>
</CALIBRATION_EQUIP_LOG_ACTIVITY>
<SYS_BUSINESS_NUMBER>
<label>Equipment Log Number</label>
<hint/>
</SYS_BUSINESS_NUMBER>
<CALIBRATION_EQUIP_LOG_ACTIVE>
<label>Active?</label>
<hint/>
</CALIBRATION_EQUIP_LOG_ACTIVE>
<CALIBRATION_EQUIP_LOG_RECORD_LINK>
<label>Equipment Record</label>
<hint/>
<help>Link to the relevant equipment record in Master Data.</help>
</CALIBRATION_EQUIP_LOG_RECORD_LINK>
<CALIBRATION_EQUIP_LOG_NUMBER>
<label>Equipment Number</label>
<hint>APAF equipment ID number</hint>
</CALIBRATION_EQUIP_LOG_NUMBER>
<CALIBRATION_EQUIP_LOG_NAME>
<label>Equipment Name</label>
<hint/>
</CALIBRATION_EQUIP_LOG_NAME>
<CALIBRATION_EQUIP_LOG_CATEGORY>
<label>Equipment Category</label>
<hint/>
<item>
<label>First choice</label>
<value>1</value>
</item>
<item>
<label>Second choice</label>
<value>2</value>
</item>
<item>
<label>Third choice</label>
<value>3</value>
</item>
</CALIBRATION_EQUIP_LOG_CATEGORY>
<CALIBRATION_EQUIP_LOG_ADD>
<label>Add Log</label>
<hint/>
</CALIBRATION_EQUIP_LOG_ADD>
</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:instance xxf:readonly="true" xxf:exclude-result-prefixes="#all"
id="CALIBRATION_EQUIP_LOG_ACTIVITY-template">
<CALIBRATION_EQUIP_LOG_ACTIVITY-iteration>
<CALIBRATION_EQUIP_LOG_ACTIVITY_DATE/>
<CALIBRATION_RECORD_PERFORM_BY/>
<CALIBRATION_EQUIP_LOG_ACTIVITY_ATTACH filename="" mediatype="" size=""/>
<CALIBRATION_EQUIP_LOG_ACTIVITY_NOTES/>
</CALIBRATION_EQUIP_LOG_ACTIVITY-iteration>
</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="CALIBRATION_EQUIP_LOG_DETAILS-control"
bind="CALIBRATION_EQUIP_LOG_DETAILS-bind">
<xf:label ref="$form-resources/CALIBRATION_EQUIP_LOG_DETAILS/label"/>
<fr:grid>
<xh:tr>
<xh:td>
<xf:input id="SYS_BUSINESS_NUMBER-control" bind="SYS_BUSINESS_NUMBER-bind">
<xf:label ref="$form-resources/SYS_BUSINESS_NUMBER/label"/>
<xf:hint ref="$form-resources/SYS_BUSINESS_NUMBER/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
</xh:td>
<xh:td>
<xf:input id="CALIBRATION_EQUIP_LOG_ACTIVE-control"
bind="CALIBRATION_EQUIP_LOG_ACTIVE-bind">
<xf:label ref="$form-resources/CALIBRATION_EQUIP_LOG_ACTIVE/label"/>
<xf:hint ref="$form-resources/CALIBRATION_EQUIP_LOG_ACTIVE/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
</xh:td>
<xh:td rowspan="1">
<xf:trigger id="CALIBRATION_EQUIP_LOG_RECORD_LINK-control" appearance="minimal"
bind="CALIBRATION_EQUIP_LOG_RECORD_LINK-bind">
<xf:label ref="$form-resources/CALIBRATION_EQUIP_LOG_RECORD_LINK/label"/>
<xf:hint ref="$form-resources/CALIBRATION_EQUIP_LOG_RECORD_LINK/hint"/>
<xf:help ref="$form-resources/CALIBRATION_EQUIP_LOG_RECORD_LINK/help"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:trigger>
</xh:td>
</xh:tr>
<xh:tr>
<xh:td>
<xf:input id="CALIBRATION_EQUIP_LOG_NUMBER-control"
bind="CALIBRATION_EQUIP_LOG_NUMBER-bind">
<xf:label ref="$form-resources/CALIBRATION_EQUIP_LOG_NUMBER/label"/>
<xf:hint ref="$form-resources/CALIBRATION_EQUIP_LOG_NUMBER/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
</xh:td>
<xh:td>
<xf:input id="CALIBRATION_EQUIP_LOG_NAME-control" bind="CALIBRATION_EQUIP_LOG_NAME-bind">
<xf:label ref="$form-resources/CALIBRATION_EQUIP_LOG_NAME/label"/>
<xf:hint ref="$form-resources/CALIBRATION_EQUIP_LOG_NAME/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
</xh:td>
<xh:td>
<xf:select1 id="CALIBRATION_EQUIP_LOG_CATEGORY-control"
bind="CALIBRATION_EQUIP_LOG_CATEGORY-bind"
appearance="dropdown">
<xf:label ref="$form-resources/CALIBRATION_EQUIP_LOG_CATEGORY/label"/>
<xf:hint ref="$form-resources/CALIBRATION_EQUIP_LOG_CATEGORY/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:itemset ref="$form-resources/CALIBRATION_EQUIP_LOG_CATEGORY/item">
<xf:label ref="label"/>
<xf:value ref="value"/>
</xf:itemset>
</xf:select1>
</xh:td>
</xh:tr>
<xh:tr>
<xh:td>
<xf:trigger id="CALIBRATION_EQUIP_LOG_ADD-control" bind="CALIBRATION_EQUIP_LOG_ADD-bind">
<xf:label ref="$form-resources/CALIBRATION_EQUIP_LOG_ADD/label"/>
<xf:hint ref="$form-resources/CALIBRATION_EQUIP_LOG_ADD/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:insert ev:event="DOMActivate" context="../../CALIBRATION_EQUIP_LOG_ACTIVITY"
ref="CALIBRATION_EQUIP_LOG_ACTIVITY"
at="1"
postion="before"
origin="instance('CALIBRATION_EQUIP_LOG_ACTIVITY-template')"/>
</xf:trigger>
</xh:td>
<xh:td/>
<xh:td/>
</xh:tr>
</fr:grid>
</fr:section>
<fr:section id="CALIBRATION_EQUIP_LOG_ACTIVITY-control"
bind="CALIBRATION_EQUIP_LOG_ACTIVITY-bind"
repeat="content"
min="1"
template="instance('CALIBRATION_EQUIP_LOG_ACTIVITY-template')">
<xf:label ref="$form-resources/CALIBRATION_EQUIP_LOG_ACTIVITY/label"/>
<fr:grid>
<xh:tr>
<xh:td>
<xf:input id="CALIBRATION_EQUIP_LOG_ACTIVITY_DATE-control"
bind="CALIBRATION_EQUIP_LOG_ACTIVITY_DATE-bind">
<xf:label ref="$form-resources/CALIBRATION_EQUIP_LOG_ACTIVITY_DATE/label"/>
<xf:hint ref="$form-resources/CALIBRATION_EQUIP_LOG_ACTIVITY_DATE/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:input>
</xh:td>
<xh:td>
<xf:select1 id="CALIBRATION_RECORD_PERFORM_BY-control" appearance="compact"
bind="CALIBRATION_RECORD_PERFORM_BY-bind">
<xf:label ref="$form-resources/CALIBRATION_RECORD_PERFORM_BY/label"/>
<xf:hint ref="$form-resources/CALIBRATION_RECORD_PERFORM_BY/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:itemset ref="$form-resources/CALIBRATION_RECORD_PERFORM_BY/item">
<xf:label ref="label"/>
<xf:value ref="value"/>
</xf:itemset>
</xf:select1>
</xh:td>
<xh:td>
<xf:textarea id="CALIBRATION_EQUIP_LOG_ACTIVITY_NOTES-control"
bind="CALIBRATION_EQUIP_LOG_ACTIVITY_NOTES-bind"
appearance="xxf:autosize">
<xf:label ref="$form-resources/CALIBRATION_EQUIP_LOG_ACTIVITY_NOTES/label"/>
<xf:hint ref="$form-resources/CALIBRATION_EQUIP_LOG_ACTIVITY_NOTES/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
</xf:textarea>
</xh:td>
<xh:td>
<fr:attachment xmlns="http://orbeon.org/oxf/xml/form-builder"
xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
id="CALIBRATION_EQUIP_LOG_ACTIVITY_ATTACH-control"
bind="CALIBRATION_EQUIP_LOG_ACTIVITY_ATTACH-bind"
class="fr-attachment">
<xf:label ref="$form-resources/CALIBRATION_EQUIP_LOG_ACTIVITY_ATTACH/label"/>
<xf:hint ref="$form-resources/CALIBRATION_EQUIP_LOG_ACTIVITY_ATTACH/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:filename ref="@filename"/>
<xf:mediatype ref="@mediatype"/>
<xxf:size ref="@size"/>
</fr:attachment>
</xh:td>
</xh:tr>
</fr:grid>
</fr:section>
</fr:body>
</fr:view>
</xh:body>
</xh:html>