cancel
Showing results for 
Search instead for 
Did you mean: 

File browser button on Adobe Interactive Form

sagar-acharya
Participant
0 Kudos

Hello,

We have a ZCI Adobe Interactive Form with XML-Schema-Based Interface.

There is a text field on the form with a button beside it. The requirement is that when this button is clicked, a file browser window should open up. After the user selects the file on PC, the file path should get populated in the text field.

I have tried using xfa.host.importData() in the Click event of the button. But nothing seems to happen.

Note that all other methods like xfa.host.messageBox() seem to work fine.

Can anybody please help?

Thanks in advance

Sagar

Accepted Solutions (0)

Answers (2)

Answers (2)

sagar-acharya
Participant
0 Kudos

Ok, I was able to solve it.

I placed a hidden text field on the form and wrote the following JavaScript on 'Click' event.

var sFile;

event.target.importDataObject(sFile);

var oFile;

oFile = event.target.getDataObject(sFile);

pa0001.Subform.FILENAME.rawValue = oFile.path;

var cFile;

cFile = event.target.getDataObjectContents(sFile);

pa0001.Subform.filecontent.rawValue = util.stringFromstreams(cFile,"utf-8");

This will upload the file content and place it in the hidden text field. I can use this hidden text field in my Web Dynpro application.

Just came to know that the Java Script we write in Adobe is known as AcroJS! Nice one.

By the way, Blag can I give points to myself for answering my own question?

Just kidding

sagar-acharya
Participant
0 Kudos

Ok, I was able to get the file browser popup using the following script:

var myDoc = event.target;

var sFile = "Temp.txt";

myDoc.importDataObject(sFile);

var myDataObject = myDoc.getDataObject(sFile);

PA0001.Subform.FILEPATH.rawValue = myDataObject.path;

But only the filename is being copied to the text field and not the entire file path.

Is there any other property of Data Object which contains the full path?

sagar-acharya
Participant
0 Kudos

Any help here?

Thanks.