Created
July 6, 2011 19:36
-
-
Save terrancesnyder/1068137 to your computer and use it in GitHub Desktop.
Simple repeater for XHTML forms.
This file contains hidden or 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
<!-- datasource --> | |
<xforms:instance id="fruits"> | |
<fruits> | |
<fruit>Apple</fruit> | |
<fruit>Orange</fruit> | |
<fruit>Pear</fruit> | |
</fruits> | |
</xforms:instance> | |
<!-- create repeater --> | |
<xforms:repeat nodeset="instance('fruits')/fruit/following-sibling::*" id="fruit-repeat"> | |
<xforms:output value="position()"/> | |
<xforms:input ref="."> | |
<xforms:label ref="."/> | |
</xforms:input> | |
<br/> | |
</xforms:repeat> | |
<!-- add button to allow adding a fruit --> | |
<xforms:trigger> | |
<xforms:label>Add fruit</xforms:label> | |
<xforms:insert ev:event="DOMActivate" context="." nodeset="instance('fruits')/fruit" | |
origin="xxforms:element('fruit')"/> | |
</xforms:trigger> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment