JavaScript - dropdown menu
I am trying to script a dropdown menu to spawn templates or multiple copies of the same templates (i.e., select "1", 1 copy of the template is spawned; select "2", 2 copies are spawned, etc.). The first issue is probably code (below: copied/altered from another community poster). The second issue: the actions are extremely limiting, and not one of the options includes selecting an item in a dropdown menu. So, if I select any of the "Mouse" options (Mouse up, Mouse down, etc.), the script spawns 1 copy just by clicking on the dropdown menu but nothing else. It's about as useful as scripting a button and clicking the button multiple times.
//get the value from dropdown control
var sel = this.getField("Dropdown").value;
//determine the template name
var templateName = "";
switch (sel) {
case 1 : templateName = "Template";
break;
case 2 : templateName = "Template"; templateName = "Template";
break;
case 3 : templateName = "Template"; templateName = "Template"; templateName = "Template";
break;
case 4 : templateName = "Template"; templateName = "Template"; templateName = "Template"; templateName = "Template";
break;
case 5 : templateName = "Template"; templateName = "Template"; templateName = "Template"; templateName = "Template"; templateName = "Template";
}
//if we have a template name, spawn the template
if (templateName != "") {
var t = this.getTemplate(templateName);
t.spawn();
}
Thank you!
