cancel
Showing results for 
Search instead for 
Did you mean: 

File Browser button from the form

Former Member
0 Kudos

I have a comment text field on my form with a browser button beside it. If the comment is too long the user should be able to attach it as a file. So when I click on the browser button, an open file window should appear, just as like when you choose Open in My Computer.

Is this possible within a form, and how?

Thanks , Peter

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

here is another way:

try

{

app.execMenuItem("AddFileAttachment");

}

catch(e)

{

xfa.host.messageBox("Cannot add an attachment: " + e);

}

Please note: You have to configure the ADS with "ReaderRights". Otherwise the file-open dialog will never appear.

Take care,

Thomas

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi, just use this code snippet:

//predefine the file identifying name local to this instance of

//the form. May have to increment the number to keep it unique and

//to attach more files. This is not the same name of the file

//that you selected in the dialog box

var theIndex = this.parent.index;

var selectFileName = "Attachment " + this.resolveNode("username").dataNode.value; // theIndex; //+

var doc = event.target;

doc.importDataObject(selectFileName); //opens the windows dialog box

var selectedFile = doc.getDataObject(selectFileName);

var filename = selectedFile.path;

// set the filename

this.resolveNode("attachment").dataNode.value = filename;

Take care,

Thomas

vaibhav_tiwari
Contributor
0 Kudos

Hi peter,

There is attach file option available with interactive form. If you are using adobe reader 8.0 then you can see attach button at below left. Using this you can attach as many files as you want to adobe form. The attached files will move with the form.

Hope it will help.

Regards,

Vaibhav Tiwari.

Former Member
0 Kudos

Yes, but is there any way I can bind this funcionality to one of my buttons on the form? So could I implement this, or not?

Former Member
0 Kudos

Hi Peter,

As far as my knowledge goes, the upload functionality that you want cannot be implemented in an Adobe Interactive form.

Regards,

Arafat