Print Page | Close Window

Spawn different page templates from dropdown

Printed From: Foxit's Planet PDF Forum
Category: Lets Talk PDF
Forum Name: JavaScript
Forum Description: Discussions relating to the use of JavaScript within PDF.
URL: http://forums.planetpdf.com/forum_posts.asp?TID=4008
Printed Date: 17 Jul 2019 at 1:34pm
Software Version: Web Wiz Forums 11.10 - http://www.webwizforums.com


Topic: Spawn different page templates from dropdown
Posted By: smfrippon
Subject: Spawn different page templates from dropdown
Date Posted: 22 Aug 2018 at 12:54pm
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




Replies:
Posted By: BAlheit
Date Posted: 23 Aug 2018 at 10:36am
Use something like this:

t.spawn({nPage: event.target.page+1, bOverlay: false});


Posted By: smfrippon
Date Posted: 05 Sep 2018 at 5:17pm
Thanks BAlheit, all sorted!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.10 - http://www.webwizforums.com
Copyright ©2001-2017 Web Wiz Ltd. - https://www.webwiz.net