Thangamani J
Thangamani J

Reputation: 21

How to submit multiple form data instances using xforms:submission tag

I would like to submit two different form data instance when i submit the form.

I tried the following it did not work for me.

 <xforms:submission id="save-instance-to-client" 
            ref="instance('form-instance-customer') instance('form-instance-customer-address')"
            action="/exist/rest/db/orbeon/data.xml"
            method="put" 
            validate="false"
            replace="none">
            <xforms:message ev:event="xforms-submit" level="modal">Attempting to save</xforms:message>
            <xforms:message ev:event="xforms-submit-error" level="modal">An error occurred while saving!</xforms:message>
  </xforms:submission>

Please suggest some way to submit multiple instances.

Upvotes: 1

Views: 838

Answers (1)

avernet
avernet

Reputation: 31753

The way you are using it, the <xforms:submission> is doing a PUT of an XML document. If you were to send 2 XML documents, you wouldn't be sending XML anymore, as XML requires one root node. So you have a couple of alternatives:

  1. Do 2 submissions, each submitting one instance, and run them in sequence.
  2. Add a root note that wraps around the two submissions, with: ref="xxforms:element('root', (instance('form-instance-customer'), instance('form-instance-customer-address')))". You specify the name of the root element in the first attribute of the xxforms:element() function. In this case, it will create an element <root>.

Upvotes: 1

Related Questions