I want my template pages to spawn in a certain order, in a certain place. Any help would be great. :)
I have a multiple page doc (for this example lets call it 5) where templates are spawned from the 3rd and 4th pages. Page 3 and 4 each have a unique checkboxes that will spawn different template pages. I want all the pages to spawn after page 4. I want them to spawn in numerical order. (Template1, Template2, Template3 etc...) or (Template2, Template3, Template5.... if user does not need Template1 or 4).
I am using this code
var v = event.target.value;
var t = this.templates;
var p = this.pageNum + 2;
for (var i = 0; i < t.length; i++){
if (t[i].name == "Template1") { // Checkbox2/page3 is "Template2"
if (v != "Off") {
t[i].spawn(p, false, false);
}
else {
this.deletePages(p, p);
}
}
}
on the checkboxes on page 3 and I am using this code
var v = event.target.value;
var t = this.templates;
var p = this.pageNum + 1;
for (var i = 0; i < t.length; i++){
if (t[i].name == "Template3") { //Checkbox2page4 is "Template4" if (v != "Off") {
t[i].spawn(p, false, false);
}
else {
this.deletePages(p, p);
}
}
}
on the checkboxes on page 4.
The two checkboxes on page3 have the same code, but different names (and different connected templates), ditto for page4.
Page1
Page2
Page3 (templates spawn 2 pages after this page)
page4 (templates spawn 1 pages after this page)
Page5
If I spawn more than one template from page 3, the first template is correct in the order, but the second template from page 3, will be put in front of the first template.
Page1
Page2
Page3
Page4
Template2 (spawned from page3 second)
Template1 (spawned from page3 first)
Page5
I would like to tell the templates to spawn in a certain order or just to spawn directly after templates already spawned. User will spawn them in the order they should be in.
Sorry for such a long question, I just wanted to be detailed as possible. I know this might be difficult thing to answer (or a lot of JavaScript) so thank you for any input on this or the way I am setting things up.
Peter Ottenbacher