Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Transform LiveCycle form xml output using xsl

Avatar

Level 3

I've completed my first form but now want to format the xml that's generated.

Whilst I work for a big Company, I don't think they'll stretch to purchasing the Reader Extensions Module so I can output as PDF. Also there will be more than 500 users completing the form, so I can't just extend the rights using Adobe Acrobat.

Therefore, I'd like to transform the xml created using xsl (as I have knowledge in this area) - I'd like the transformation to occur when the form is submitted via email so that a 'friendly' attachment is added to the email and not the xml output.

Any ideas on this one?

14 Replies

Avatar

Level 10

Is your issue, while submitting, send a "PDF" in the email attachment rather than XML file?

If you want to send PDF, you can change the option in the Submit button properties to "PDF".

Otherwise let me know..

Thanks

Srini

Avatar

Level 3

Thanks Srini but I've tried that already.

On the mouseDown event of my 'Confirm' button I've tried the following:

var

oSubmit = this.resolveNode("$..#submit");

var cToAddr = "myemailaddress";

var cSubLine = "Subject";

var cBody = "Body";

var

cEmailURL = "mailto:" + cToAddr + "?";

cEmailURL

+= "subject=" + encodeURI(cSubLine) + "&body=" + encodeURI(cBody);

oSubmit.target = cEmailURL;

oSubmit.format = pdf;

But it still gets output as xml - looking through all the forums, this is again because you need to have the Reader Extensions, etc.

Avatar

Level 10

Here is a sample that can work for you..I have not applied Reader Extensions to it..So it may be of helpful to you..

https://acrobat.com/#d=CK4QgXn38l49bzQlhWtKSA

Let me know if you still have issues..

Thanks

Srini

Avatar

Level 3

Thanks again Srini - I'll try it out and let you know.

Avatar

Level 3

Srini - I added the code you sent through to me but when I click the button I get a pop-up window with 'Submit cancelled' in it.

Any ideas to this one? Is it down to a specific version of Adobe Reader?

Thanks,

Avatar

Level 10

Can you send the form to LiveCycle9@gmail.com so I can have a look at it..

Thanks

Srini

Avatar

Level 10

First thing is, the fonts did not work in my system.. So I can not really understand where the email address fields are..

Few things:

1) You have used an Email submit button and tried to place the code in the MouseDown event.

    You need to change this button to "Regular Type Button". and place the code in the Click event to work.

2) I placed a sample button and put in my code for your reference.. This is working fine..You can check the below sample.

https://acrobat.com/#d=tQa4E*8aA*mJq6aijSHuDQ

3) You can do the same way for your form..

4) If you have Acrobat software, you can enable JavaScript debugger which can give you the specific error message rather than Submit cancelled. If you do not, then you need to put some messageBox statements and check..

Thanks

Srini

Avatar

Level 3

Srini,

I tested the example you originally gave me and I was getting the exact same error - a pop-up window with 'Submit cancelled' in it which is why I wondered if it was down to the version of Reader.

Also, the example you gave had the event firing in the preSubmit event - in the form I sent to you I had done the same thing. The button you were looking at was my original Confirm button, but my form also included the regular button you used - called 'Confirm New' in my form. This was the one I tested.

Thanks for looking though and for all your help,

Avatar

Level 3

I've now added a regular button to my form, set it as a submit button and then stuck my original code onto the preSubmit event - my original code is like this:

oSubmit = this.resolveNode("$..#submit");

var

var cToAddr = "myemailaddress";

var cSubLine = "Subject";

var cBody = "Body";

cEmailURL = "mailto:" + cToAddr + "?"; += "subject=" + encodeURI(cSubLine) + "&body=" + encodeURI(cBody);

var

cEmailURL

oSubmit.target = cEmailURL;

oSubmit.format = pdf;

Now when my email is generated it contains an XDP file rather than an XML file! But what can I do with this XDP file? When I try to open it it says it's associated to a .PDF file that can't be found.

Avatar

Former Community Member

An XDP file is an xml file. The file extension XDP is associated with Designer. You can open it in Notepad or any other editor .......you simply cannot double click it and have the appropriate application launch (because of the association).

Paul

Avatar

Level 3

Thanks Paul.

Basically I'm nowhere further along than I originally was!

I'll revert to my original question, does anyone know how (or even if it's possible) to convert the xml generated from a LiveCycle form, i.e. the xml that gets sent out via email, by using XSLT? I basically want the output of the form to be as user-friendly as possible.

Avatar

Former Community Member

You can control the structure of your xml that is produced by creating a sample data file (exactly the way you want it) and importing that

data file into the Data Conenction. Then you can bind the fields that you created to the nodes in the sample data file. Now when a

data file is produced it will follow your sample. Or if you want to build a schema to represent the data structure you can do that to.

Make sense?

paul

Avatar

Level 3

Thanks again Paul.

That does make sense, but I have to admit that sending any sort of xml to users that are not technically-minded was a last resort (not meant to be condescending).

However, sticking a schema against my output looks like my only option now.