After deleting a spawned template with multiple pages, searching for a fieldname shows it on a page number that it existed on before.
I have a form with checkboxes that will create templates in the form to fill out. I would like to uncheck the box and have it delete that particular form. I do this now by searching for a certain fieldname on that page. If it finds it, delete the page. This is my issue:
Say I have form 1 (page1), 2 (page2), 3 (page3) created. I remove 2. It removes and now there is form 1 (page1), and form 3 (now page2). When I try to delete form 3 now it searches for the specific fieldname, but it tells me that the field name is still on page 3, and thus can’t delete a page that is nonexistent, leaving form 3 (page2) still there.
How do I get it to refresh (I have used “this.calculateNow();” before AND after deletion but dosen’t work) so it sees the fieldname on the proper page, ie page 2.
Here is my code:
if (trackerField != null) {
this.calculateNow();
var trackerField = this.getField("PageTracker2_" + cbName);
var pageToDelete = Number(trackerField.value);
// Remove the tracker field
this.removeField("PageTracker2_" + cbName);
//Let me know what page the tracker is on
app.alert("On page " + pageToDelete, 3)
// Delete the page
this.deletePages(pageToDelete);
this.calculateNow();
}
Thanks!
