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

Posted by Somya Rajesh Agarwal on
URL: https://discuss.orbeon.com/Orbeon-Form-Builder-Form-Runner-for-a-regular-web-site-tp2552615p3005113.html

Hi Alex,

Thank you for your reply. I made the changes suggested by you. The insert is now working fine :)

However I tried similar changes on the delete trigger for deleting the prescription node.
1. If I change the nodeset attribute from "/patient/visits/prescriptions" to "prescriptions" the delete trigger is not working at all.
2. I could not see any change in the behavior of delete trigger on setting the context attribute to "." or   context="instance('instance_patientRecord')" or removing it all together.
3. On setting nodeset="/patient/visits/prescriptions" the previous problem persisits

Please provide a solution for this.

Thanks and Regards,
Somya

-----Original Message-----
From: Alessandro Vernet [mailto:[hidden email]]
Sent: Thursday, October 21, 2010 3:25 AM
To: [hidden email]
Subject: [ops-users] Re: Issue on Working with nested <xforms:repeat>

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