Hi Everyone,
I'm fairly new to XForms, and I'm attempting to understand nested repeats (apparently I've seen on this forum that many others were attempting the same). I've looked through this forum regarding nested repeats but haven't found yet an answer to my unusual problem. Below is my XHTML code: <html xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns="http://www.w3.org/1999/xhtml"> <head> <title>XForms application generated from constraint schema.</title> <xf:model schema="phil2.xsd"> <xf:instance xmlns="" id="views"> <metadata-add-trigger> <idinfo-add-trigger> <citation-add-trigger> <origin /> <pubdate /> <pubtime /> </citation-add-trigger> </idinfo-add-trigger> </metadata-add-trigger> </xf:instance> <xf:instance xmlns="" id="template"> <metadata-add-trigger> <idinfo-add-trigger> <citation-add-trigger> <origin /> <pubdate /> <pubtime /> </citation-add-trigger> </idinfo-add-trigger> </metadata-add-trigger> </xf:instance> <xf:bind nodeset="instance('views')/metadata-add-trigger"> <xf:bind nodeset="idinfo-add-trigger"> <xf:bind nodeset="citation-add-trigger"> <xf:bind nodeset="origin" required="true()"/> <xf:bind nodeset="pubdate" required="true()"/> <xf:bind nodeset="pubtime" required="true()"/> </xf:bind> </xf:bind> </xf:bind> <xf:submission id="list-submission" serialization="none" method="get" action="/exist/rest/db/orbeon/xforms-generator/metadata.xml" replace="instance" instance="books-instance"/> <xf:submission id="save-submission" ref="instance('views')" action="/exist/rest/db/orbeon/xforms-generator/metadata.xml" method="put" replace="none"> <xf:message ev:event="xforms-submit-error" level="modal">An error occurred while saving!</xf:message> </xf:submission> </xf:model> </head> <body> <xf:submit submission="save-submission" appearance="minimal"> <xf:label> Save </xf:label> </xf:submit> <br /> <xf:submit submission="list-submission" appearance="minimal"> <xf:label> Revert </xf:label> </xf:submit> <br /> <xf:group ref="instance('views')"> <xf:label class="group-label">Standard Profile</xf:label> <xf:help>Standard Profile</xf:help> <br /> <xf:trigger appearance="minimal"> <xf:label>Add Identification Information</xf:label> <xf:insert ev:event="DOMActivate" context="instance('views')" nodeset="idinfo-add-trigger" at="1" position="before" origin="instance('template')//idinfo-add-trigger"/> </xf:trigger> <br /> <xf:repeat nodeset="instance('views')//idinfo-add-trigger" id="idinfo-add-trigger-repeat"> <xf:label class="group-label">Identification Information</xf:label> <xf:help>Stuff.</xf:help> <xf:trigger appearance="full"> <xf:label>Delete Identification Information</xf:label> <xf:delete ev:event="DOMActivate" context="instance('views')" nodeset="//idinfo-add-trigger" at="index('idinfo-add-trigger-repeat')"/> </xf:trigger> <br /> <xf:trigger appearance="minimal"> <xf:label>Add Citation</xf:label> <xf:insert ev:event="DOMActivate" context="instance('views')//idinfo-add-trigger" at="1" position="before" origin="instance('template')//citation-add-trigger"/> </xf:trigger> <br /> <xf:repeat nodeset="citation-add-trigger" id="citation-add-trigger-repeat"> <xf:label class="group-label">Citation</xf:label> <xf:help>Stuff.</xf:help> <xf:trigger appearance="full"> <xf:label>Delete Citation Information</xf:label> <xf:delete ev:event="DOMActivate" context="instance('views')" nodeset="//citation-add-trigger" at="index('citation-add-trigger-repeat')"/> </xf:trigger> <br /> <xf:input ref="origin"> <xf:label>Originator : </xf:label> <xf:help>The name of an organization or individual that developed the data set. If the name of editors or compilers are provided, the name must be followed by '(ed.)' or '(comp.)' respectively.</xf:help> </xf:input> <xf:input ref="pubdate"> <xf:label>Publication Date : </xf:label> <xf:help>The date when the data set is published or otherwise made available for release.</xf:help> </xf:input> <xf:select1 ref="pubtime"> <xf:label>Publication Time</xf:label> <xf:item> <xf:label>None</xf:label> <xf:value/> </xf:item> <xf:item> <xf:label>Today</xf:label> <xf:value/> </xf:item> <xf:item> <xf:label>Yesterday</xf:label> <xf:value/> </xf:item> </xf:select1> </xf:repeat> </xf:repeat> </xf:group> </body> </html> Identification Information is the top section which has add/delete support, and Citation is the sub-section beneath it which also has add/delete support. I'm trying to get this to work in Mozilla before I try it in Orbeon, and it ALMOST works perfectly, except the fact that when I try to add another Identification Information section, and then in that new section add some Citations, the citations are added to the previous Identification Information section, not the new one I just created. The procedure I was trying to follow can be found via this link, under Section 10.2: http://www.orbeon.com/ops/doc/reference-xforms-guide#insert-origin-attribute Can someone help me understand why this is happening, and what I could possibly do to fix this problem? And if this question has already been answered, please feel free to link me there. :) Thanks in advance! ~Philip |
Philip,
attached is one of my favorite nested repeat samples that I believe was put on the list by Alex. It runs in the /xforms-sandbox/! It achieves what you wish to do. cheers -- einar
On Fri, Apr 10, 2009 at 4:11 PM, 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 nested-repeat-context.xhtml (3K) Download Attachment |
Einar,
I've actually seen this example before, and while it is also one of my favorite examples as well, it doesn't do exactly what I'd like. What I am looking for is a way to have that same functionality, but also show an instance of each inner repeat as well. In other words, using your attached example, something that looks like this when the XForms document is first loaded: Book Insert Section Section delete Insert Paragraph Paragraph: 1 ----------- delete ---Philip <quote author="parisiana"> Philip, attached is one of my favorite nested repeat samples that I believe was put on the list by Alex. It runs in the /xforms-sandbox/!<http://www.orbeon.com/ops/xforms-sandbox/> It achieves what you wish to do. cheers -- einar |
Einar,
The example you provided (and that Alex created) helped me to obtain exactly what I wanted. I now have the same XForm, but with all of the subsections showing as well (attached below is my revised XHTML document). If anybody is curious, the key to solving my problem consisted of three things: 1) Modifying my instance data. ---I did not know initially that this was the force behind what is displayed on the screen; I had originally thought that to be the 'nodeset' attribute of <xf:repeat>, but it only controls the repetition of an item, not whether it's displayed on the screen. 2) Modifying my template data. ---To be consistent with the instance data. 3) Changing the 'origin' attribute of the Insert Paragraph trigger. ---Since the template data had changed, I needed to update the XPath expression in the 'origin' attribute to reflect the changed data. My biggest problem with this was finally understanding that, when referring to instance data via an XPath expression, the root element can be omitted. If I said anything incorrect here, please let me know so that I don't confuse other XForms beginners. :-) ---Philip <quote author="Philip.Cantin"> Einar, I've actually seen this example before, and while it is also one of my favorite examples as well, it doesn't do exactly what I'd like. What I am looking for is a way to have that same functionality, but also show an instance of each inner repeat as well. In other words, using your attached example, something that looks like this when the XForms document is first loaded: Book Insert Section Section delete Insert Paragraph Paragraph: 1 ----------- delete ---Philip nested-repeat-context2.xhtml |
That's great.
-- einar On Fri, Apr 10, 2009 at 7:59 PM, 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 |