I checked the archives and came across a thread from a few months ago that touches on what I want to do. I have an optional element, but I want to limit how many times it can repeat. Let's say, for example, no more than two times. Here is the thread: http://www.nabble.com/control-the-numbers-of-a-repeated-component-in-a-node-td23313475.html#a23494458 . Here is another good source on binding/relevant: http://en.wikibooks.org/wiki/XForms/Relevant
I'm having problems putting it into practice. I have it almost working, but I must be missing something. Here is a bit of code: <xforms:bind nodeset="editionstmt" relevant="count(//editionstmt) < 3"/> <xforms:trigger appearance="minimal" ref="editionstmt"> <xforms:label> <img src="../apps/editor/images/add.gif"/>Add Edition Statement</xforms:label> <xforms:insert ev:event="DOMActivate" context="." origin="instance('editionstmt-template')" nodeset="."/> </xforms:trigger> <xforms:repeat nodeset="editionstmt"> <div> <xforms:input ref="edition"> <xforms:label>Edition</xforms:label> </xforms:input> </div> </xforms:repeat> This example disables the trigger only after it has been clicked to add a third item. Not only does the trigger disappear, but the two existing inputs also disappear. My guess is that I have constructed the relevant attribute incorrectly. Does anyone know a better way of doing this? Thanks, Ethan Gruber -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Ethan,
Try wrapping an xforms:group statement around your xforms:trigger element, like so: <xforms:group ref=".[count(//editionstmt) < 3]"> <xforms:trigger appearance="minimal"> <xforms:label> Add Edition Statement</xforms:label> <xforms:insert ev:event="DOMActivate" context="." origin="instance('editionstmt-template')" nodeset="."/> </xforms:trigger> </xforms:group> This will cause the trigger to disappear when the count of editionstmt hits 3, but it shouldn't affect anything within your xforms:repeat. In addition, if you provide a reproducible sandbox example I could try and give you more insight as to why your previous code wasn't working as you expected it to. ---Philip
|
Hi Philip,
Thanks for the help! I got it working exactly the way I want it to. Ethan On Thu, Aug 20, 2009 at 11:28 AM, Philip.Cantin <[hidden email]> wrote:
-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |