Re: Issue on Working with nested <xforms:repeat>

Posted by Alessandro Vernet on
URL: https://discuss.orbeon.com/Orbeon-Form-Builder-Form-Runner-for-a-regular-web-site-tp2552615p3004698.html

Somya,

You were almost there. The only issue I noticed was that the
prescription insert was always adding a new prescription to the last
appointment, instead of the current appointment. For this, that button
needs to be:

<xforms:trigger appearance="minimal">
    <xforms:label>Add One</xforms:label>
    <xforms:insert ev:event="DOMActivate"
                   nodeset="prescriptions"
                   at="1" position="before"
                   origin="instance('prescriptions-template')"/>
</xforms:trigger>

I removed the "context" attribute, and notice how there is just
nodeset="prescriptions". The current context is a <vistits>, since you
are inside a <xforms:repeat nodeset="/patient/visits">, so just
referring to nodeset="prescriptions" references the <prescriptions>
element inside the current node. If there are cases where you can have
zero prescriptions, then you still need to have context=".", otherwise
the <xforms:insert> won't know where to do the insertion.

For reference, I attached the full example with the above update.

Alex


On Wed, Oct 20, 2010 at 12:19 AM, Somya Rajesh Agarwal
<[hidden email]> wrote:

> Hi all,
>
> I need to have nested <xforms:repeat> control in my xform.
>
> For ex. As per the below template, the form should enable the multiple 'appointments' entries. Also for each 'appointment' multiple 'prescriptions' entry is required.
>
>        <appointment>
>                <date />
>                <diagnosis />
>                <prescription>
>                        <drug />
>                        <noOfDays>
>                        <dosage>
>                </prescription>
>        </appointment>
>
> The outer repeat is working as expected but inner repeat on prescriptions is not working fine.
>
> Here is the problem:
> 1. Suppose I have an 'appointment' node in the beginning say 'app-a'.
> 2. Now I add 'app-b'.
> 3. Both 'app-a' and 'app-b' have one 'prescription' node each by default.
> 4. Now, when I add a 'prescription' node or delete a 'prescription' node in 'app-a', the 'prescription' node in 'app-b' get             added/deleted.
>
> Kindly help me resolve this problem. Please find attached the code (index5.jsp) I am using.
>
> Would highly appreciate your help.
>
> P.S. In the orbeon architecture I have placed the file "index5.jsp" at WebContent/xforms-jsp/<new-folder>
>
> Thanks and Regards,
> Somya
>
>
> --
> 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
>
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise -
http://www.orbeon.com/
My Twitter: http://twitter.com/avernet


--
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

20101020-nested-repeat.xhtml (11K) Download Attachment
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet