Skip to content

Instantly share code, notes, and snippets.

@orbeon
Last active August 29, 2015 14:11
Show Gist options
  • Save orbeon/5d592bfa4640569b116f to your computer and use it in GitHub Desktop.
Save orbeon/5d592bfa4640569b116f to your computer and use it in GitHub Desktop.
Test of repeated fr:grid component
<xh:html
xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner">
<xh:head>
<xf:model>
<xf:instance id="new">
<form min="1" max="3">
<note>
<note-iteration xmlns="">
<note-text/>
</note-iteration>
</note>
</form>
</xf:instance>
<xf:bind ref="instance('new')/note" id="note-bind" name="note">
<xf:bind ref="note-iteration" id="note-iteration-bind">
<xf:bind ref="note-text" id="note-text-bind"/>
</xf:bind>
</xf:bind>
<xf:instance id="note-template">
<note-iteration xmlns="">
<note-text/>
</note-iteration>
</xf:instance>
<xf:instance id="legacy">
<form min="1" max="3">
<note>
<note-text/>
</note>
</form>
</xf:instance>
<xf:bind ref="instance('legacy')/note" id="legacy-note-bind" name="legacy-note">
<xf:bind ref="note-text" id="legacy-note-text-bind"/>
</xf:bind>
<xf:instance id="legacy-note-template">
<note>
<note-text/>
</note>
</xf:instance>
</xf:model>
</xh:head>
<xh:body>
<xh:h2>New</xh:h2>
<xf:group context="instance('new')">
<xf:input ref="@min"/>
<xf:input ref="@max"/>
<fr:grid
id="note-grid"
repeat="content"
bind="note-bind"
template="instance('note-template')"
min="{../@min}"
max="{../@max}"
remove-constraint="note-text != '42'">
<xh:tr>
<xh:td>
<xf:textarea id="note-text-control" bind="note-text-bind">
<xf:label>Note!</xf:label>
</xf:textarea>
</xh:td>
</xh:tr>
</fr:grid>
</xf:group>
<xf:group context="instance('legacy')">
<xf:input ref="@min"/>
<xf:input ref="@max"/>
<xh:h2>Legacy</xh:h2>
<fr:grid
id="legacy-note-grid"
repeat="true"
bind="legacy-note-bind"
template="instance('legacy-note-template')"
min="{@min}"
max="{@max}"
remove-constraint="note-text != '42'">
<xh:tr>
<xh:td>
<xf:textarea id="legacy-note-text-control" bind="legacy-note-text-bind">
<xf:label>Note!</xf:label>
</xf:textarea>
</xh:td>
</xh:tr>
</fr:grid>
</xf:group>
</xh:body>
</xh:html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment