Skip navigation
Currently Being Moderated

Trouble with opening an attachment with JS

Jul 9, 2012 12:23 PM

Here is the code that is causing me fits.

 

var myN = this.documentFileName;

var myLang = myN.split("_");

 

The line below is giving me an error when I execute it by pressing a button.

 

this.exportDataObject({ cName: "Page5_Feb_spinner_" + myLang[1] + ".pdf", nLaunch: 2 });

 

Here is the error message.

 

TypeError: Invalid argument type.

Doc.exportDataObject:4:Field Button1:Mouse Up

===> Parameter cName.

 

The first two lines of the script get the name of the file which is "08994_eng.pdf" and split it up so it can get the eng part of the file name.

 

If I hard code the name of the file that is attached to the PDF that is supposed to be opened then the line of code below works just fine.

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

 

I have used this method of concatenating various elements into one line before but am not sure why it isn't working in this instance.

 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points