Skip to main content
Participant
October 27, 2022
Answered

Extract form values to a XML file using JS actions

  • October 27, 2022
  • 1 reply
  • 1354 views

Hi
I'm trying to get values of some specific form fields and then generate a XML file based on that data using JS actions when a user clicks a button. It's possible to get those values but I'm not sure how to generate that xml and provided to the user. Any help would be appreciated.

This topic has been closed for replies.
Correct answer bebarth

Hi,

Try this attached file and the action wizard included (not possible to save the xml file from the button).

Script:

var spans=this.getField("text1").richValue;
var str=util.spansToXML(spans);
this.createDataObject("theFile.xml",str);
var spans=util.xmlToSpans(str);
this.getField("text2").richValue=spans;
this.getField("text3").value=str;
this.exportDataObject("theFile.xml");

@+

 

1 reply

bebarth
Community Expert
bebarthCommunity ExpertCorrect answer
Community Expert
October 27, 2022

Hi,

Try this attached file and the action wizard included (not possible to save the xml file from the button).

Script:

var spans=this.getField("text1").richValue;
var str=util.spansToXML(spans);
this.createDataObject("theFile.xml",str);
var spans=util.xmlToSpans(str);
this.getField("text2").richValue=spans;
this.getField("text3").value=str;
this.exportDataObject("theFile.xml");

@+

 

Participant
October 27, 2022

woow, thanks mate