Copy link to clipboard
Copied
Hello All,
I would like to implement a popup-menu in my PDF form. By choosing options in the popup-menu the PDF reader should have the possiblity to open attached files in a new window.
Based on following javascript, attached files "Option1.pdf" etc. in accordance to user`s choice should be opened in a new window.
var cRtn = app.popUpMenu("Option1","Option2","-","Option3","Option4");
Any comments and ideas are highly appreciated.
Best regards
Florian
Copy link to clipboard
Copied
After that line of code add something like this:
this.openDataObject(cRtn + ".pdf");
Copy link to clipboard
Copied
Hello try67,
many thanks for your prompt reply. In accordance to user`s choice different PDF attachements should be opened in a new window.
For this reason in my opinion an "if" command is necessary. Furthermore how I could make sure that the attached PDF will be opened in a new window?
As I am pnot professional java script programmist, I would be very grateful, if you could help me with the java scriting.
Best regards
Florian
Copy link to clipboard
Copied
You can't specify how the file is opened in the script. That depends on the application.
And I don't see a need for an if-statement. The line of code I provided takes the user's selection and tried to open the attached file that matches it. Isn't that what you wanted?
Copy link to clipboard
Copied
The main PDF form has 4 attached files, which are opened in a seperate window, depending on users choice.
Is something like this possible to handle by java script app.popUPMenu ?
Copy link to clipboard
Copied
Did you try what I suggested?
Copy link to clipboard
Copied
I have tried
this.openDataObject(cRtn + ".pdf"); ...unfortunately not working.
Actually trying following script:
var cRtn = app.popUpMenu("Option1","Option2","Option3","Option4");
if (cRtn != "Option1"){
this.exportDataObject({ cName: "1.pdf", nLaunch: 2 });
} else if (cRtn != "Option2"){
this.exportDataObject({ cName: "2.pdf", nLaunch: 2 });
} else if (cRtn != "Option3"){
this.exportDataObject({ cName: "3.pdf", nLaunch: 2 });
}
It is opening attachment in new window, however mixing the attachments. Anz idea, where the bug is?
Copy link to clipboard
Copied
Well, from your original question I had understood that the names of the attached files are identical (except for the file-extension) to the options in the pop-up menu ("Option1" -> "Option1.pdf"), but from the code above it seems that's not the case ("Option1" -> "1.pdf).
In that case you do need an if-condition (although if you used popUpMenuEx then you could specify a return value for each option and the if-condition could be removed).
I think the error is that you're using the wrong operator. You're using the NOT EQUALS-operator ("!=") instead of the EQUALS-operator ("=="). Change it and it should work as you want it to.
Copy link to clipboard
Copied
try67, it works! Many thanks!
Copy link to clipboard
Copied
As there will be many different attached reference files and the main PDF will get quite heavy, is there also an option to work with download links from server? That means, that through the popup menu files could be downloaded from the server?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now