avernet
avernet

Reputation: 31743

How can I access the XML captured by a form I create in From Builder from JavaScript?

With Orbeon Forms, I created a form in Form Builder. Since Orbeon Forms uses XForms, the data in the form is captured in an XML document. That document is sent to the persistence API when saved, but how can I access it before that, on the browser, through JavaScript?

Upvotes: 0

Views: 125

Answers (1)

avernet
avernet

Reputation: 31743

  1. In Form Builder, edit the source, and add the following line inside the <fr:body> element, say before the first <fr:section>:

    <xf:output value="saxon:serialize(/*, 'xml')" 
               id="my-xml" style="display: none"/>
    
  2. In JavaScript, you can access the value of the my-xml control you added with:

    ORBEON.xforms.Document.getValue('my-xml')
    

Upvotes: 1

Related Questions