Expand my Community achievements bar.

How to change XML Tag attribute on submit

Avatar

Level 2

I have a form that I submit to a database using XDP through a HTTPS XML post.  I can post the forms fields to the database with no problems.

However, I want to upload an attachment along with the XML post; the database does accept attachments as a base64.

I have a textfield on the form to which I convert the PDF document to a base64 sting using the following code (which I found elsewhere on this forum):

TextField1.rawValue

= SOAP.stringFromStream(SOAP.streamEncode(Collab.documentToStream(event.target),

"base64"));

The question I have is how to change the XML tag in the LiveCycle form to include the file name attribute required by the database.  They want the the tag to be formatted in the following manner:

<TextField1 filename=testfile.pdf>base64 encoded binary data</TextField1>

Ideally, I would like to make this file name dynamic based on another field in the form, but this is a secondary concern.

The attached file has a fake URL for the submit button and email address.  Just need to get the filename= part working.

2 Replies

Avatar

Former Community Member

Ok I have done this but in a round about way. I created a sample data file (from the File/Form Properties/Preview menu). I then modified the data file to include the filename attribute. Then I went to the DataView tab and used the sample XML file as a data structure to follow. I then bound the fields appropriately and finally added the code to the button to put the filename into the filename field (that I created when I did the bindings). Attached is a modified sample. Let me know what you think.

Paul

Avatar

Level 2

Paul,

This works.  Thanks!

I am still working through the implications of having a data connection defined.  I notice that every time I submit, it creates two records in my database, one with all the fields blank, and one with the data and attachment.

I will have to do some more digging into the double submission, but at least it is uploading the file.

Thanks again,

Ed