Copy link to clipboard
Copied
Hi I'm currently trying to make a pdf spawn different page templates based on the selections from a dropdown and I can't seem to get it to work:
I have the drop down named "Brief Type 3" containing 5 items with export values from 1-5. I also have a button to receive these values.
I have 5 page templates named 'spawn1', 'spawn2' 'spawn3' 'spawn4' 'spawn5'.
I'm using the following:
var sel = this.getField("Brief Type 3").value;
var templateName = "";
switch (sel) {
case 1 : templateName = "spawn1";
break;
case 2 : templateName = "spawn2";
break;
case 3 : templateName = "spawn3";
break;
case 4 : templateName = "spawn4";
break;
case 5 : templateName = "spawn5";
break;
}
if (templateName != "") {
var t = this.getTemplate(templateName);
t.spawn();
}
What am I doing wrong??
Any help would be greatly appreciated.
Thanks
Sam
Then you need to change this:
t.spawn();
To something like this:
t.spawn({nPage: event.target.page+1, bOverlay: false});
Copy link to clipboard
Copied
Where did you place the code?
Are there any error messages when you run it?
If you don't specify any parameters for the spawn method it will spawn the template over the existing first page of the file. It won't create a new page. Is that what you want to happen?
Copy link to clipboard
Copied
Hi, I placed the code on a mouse up on the OK button, I'd like all spawned pages to go after the page that is generating it, i.e. the one with the dropdown/ok button.
Thanks
Sam
Copy link to clipboard
Copied
There are also no error messages
Copy link to clipboard
Copied
Then you need to change this:
t.spawn();
To something like this:
t.spawn({nPage: event.target.page+1, bOverlay: false});
Copy link to clipboard
Copied
Thanks try67 but still getting the same result, or no result. The button reacts but the dropdown just resets to default and no page is spawned!
I'm lost!
Copy link to clipboard
Copied
I'm just going to use radio buttons instead.
Thank you for your help anyway!!
Copy link to clipboard
Copied
Can you share the file with us (via Dropbox, Google Drive, Adobe Send & Track, etc.)?
Copy link to clipboard
Copied
wetransfer link below:
Copy link to clipboard
Copied
Works fine for me, although I don't like the use of the list box for that. You should convert it to a drop-down field.
Copy link to clipboard
Copied
It works in Acrobat Reader DC and Adobe Acrobat DC.
Copy link to clipboard
Copied
Thank's both, it seems its an issue with my acrobat install, just tried it on a colleague's machine and it works!
thanks again!