replacing instance containing some items

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

replacing instance containing some items

Bernard Mramba
Hi All,
I am new to XForms.
I want to replace an instance that contained data that I have just submitted with another instance.
I tried this way.
<xforms:submission id="get-items" ref="instance('scenario-instance')" replace="instance" instance="items-set-instance" method="post" action="/demo-customer/services/get-items-set">
</xforms:submission>

<xforms:submission id="save-items-values" ref="instance('items-set-instance')" replace="none" method="post" action="/demo-customer/services/save-items-values">
        <xforms:message ev:event="xforms-submit-error" level="modal">Failed!</xforms:message>
        <xforms:action ev:event="xforms-submit-done">
           <xforms:send submission="get-items" /> 
           <xforms:message level="modal">All values saved successfully!</xforms:message>
        </xforms:action>
</xforms:submission>

On submitting the form, the instance is overwritten with the new items inserted into the previous items.

Something like this.
<item>
   <item-id>22</item-id>
   <item-name>Market price</item-name>
   <item-value/>
   <item-comments/>
 </item>

<item>
   <item-id>22</item-id>
   <item-name>Market price</item-name>
   <item-value>1.00</item-value>
   <item-comments/>
</item>

<item>
   <item-id>23</item-id>
   <item-name>FOB price</item-name>
   <item-value/>
   <item-comments/>
</item>

<item>
   <item-id>23</item-id>
   <item-name>FOB price</item-name>
   <item-value>1.00</item-value>
   <item-comments/>
</item>




Please anyone can assist me?
With thanks.
Regards.

Reply | Threaded
Open this post in threaded view
|

Re: replacing instance containing some items

Bernard Mramba
I found out that there was a problem with the query that was returning the data.
Thanks,
Regards.