on 07-28-2008 7:13 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.