Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
6

How can I spawn two templates with one button click from a dropdown list?

New Here ,
Aug 19, 2023 Aug 19, 2023

Hello all,

 

Thank you in advance to all the helpful people on this forum!

 

I'm creating a form where users can append additional pages to the end of the document as needed using a dropdown  menu that is activated by use of a button which spawns those pages from their templates.  Some of those additional pages are different translated versions of the same text.  Unfortunately the Russian translation changes the one page letter to a two page.  I want users to be able to select "Russian Notification Letter" from the dropdown, click the button, and get both templates that comprise this one document.  Below is the script I added to the button.  You can see I tried to use the one export value from the dropdown for two different cases, and that didn't work.  I've attached that part of the form in question.  The drop-down and button are at the bottom.

 

var sel = this.getField("Notifications").value;

var templateName = "";

switch (sel) {

case 1 : templateName = "Notification Letter";

break;

case 2 : templateName = "Spanish Notification";

break;

case 3 : templateName = "Mandarin Notification";

break;

case 4 : templateName = "Russian Notification 1";

break;

case 4 : templateName = "Russian Notification 2";

break;

}

if (templateName != "") {

var t = this.getTemplate(templateName);

t.spawn();


}

TOPICS
How to , JavaScript , PDF forms
673
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Aug 20, 2023 Aug 20, 2023

You can't have two cases 4, so remove one.

As case 4 use this:

  case 4:
    var t1 = this.getTemplate("Russian Notification 1");
    t1.spawn();
    
    var t2 = this.getTemplate("Russian Notification 2");
    t2.spawn();
    break;

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 20, 2023 Aug 20, 2023

You can't have two cases 4, so remove one.

As case 4 use this:

  case 4:
    var t1 = this.getTemplate("Russian Notification 1");
    t1.spawn();
    
    var t2 = this.getTemplate("Russian Notification 2");
    t2.spawn();
    break;
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 20, 2023 Aug 20, 2023
LATEST

You're awesome! Worked perfectly. Thank you! 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines