Expand my Community achievements bar.

is this possible to do with attachments??

Avatar

Former Community Member
Hi all,



In my form, i have made a form so users can attach files to the form.

It looks like the below



[Attach file button] [file name field]



The code on [click]



var doc = event.target;

doc.importDataObject("Marketing Material files 1");

var MyPar1 = doc.getDataObject("Marketing Material files 1");



form1.Section1New.section115.MarketingMaterialBody1.marketingFile1.rawValue = MyPar1.path;



------------

So when they've attached a file, it will show the files name in the file name field. The attachment is shown in the attachments tab on the bottom of the form.



What i want to know is if it is possible for them to click on the file name field to open up the attachment? instead of using the tabs on the bottom to open attachments?. This form is quite large with alot of attachments, so it would make it more user friendly if they could open the attachments at each section instead of having to use the attachments panel on the bottom and read the descriptions to work out which section each attachment belongs. i think to do this i need to know how to retrieve the attachments path? but i'm not sure how i would do this.



Any help would be greatly appreciated.

Thanks
3 Replies

Avatar

Former Community Member
You could use a button to retreive and display the actual attachment by using this:

this.exportDataObject({ cName: "MyData", nLaunch: 2 });



where MyData is the description of your attachment.



On your "attach file button" you could add the following:

var MyData = this.getDataObject("MyData1");

var filename = MyData.path;

var f = this.getField("Yor attach file button");

f.buttonSetCaption(filename);



This displays the attachment "Name" on your "Open attachment" button



Hope this helps

Avatar

Former Community Member
Thanks for that!!



i had to change it a bit to work on my form



event.target.exportDataObject({ cName: "MyData", nLaunch: 2 });

Avatar

Level 5
I can not make this code work for me (even after I add appropriate user rights). Can one of you help me with a sample template. Please email me at meetsekharv@yahoo.com



Thanks in advance,

SekharN