Skip to main content
Inspiring
August 4, 2023
Question

Trouble with Checkbox mouse-up script to spawn/delete pages

  • August 4, 2023
  • 1 reply
  • 495 views

I have a mouse-up javascript containing a doc-level function name, when selected spawns 5pp. When unselected the spawned pp don't delete. I've re-written the doc-level function script, assigned unique fields names across the 5 spawned pages, and re-created the templates, all following suggestions I found here in the Community. The Console also displays no errors. Here's the doc-level script I'm using.

function calcP19Marker()
{
var P19 = getSpawnedPageNumber(this, "P19Marker");
if (this.getField("CkBxNMVTIS").valueAsString=="Yes" ) {
if (P19==-1) {
this.calculate = false;
this.getTemplate("p19").spawn(this.numPages, false, false);
this.getTemplate("p20").spawn(this.numPages, false, false);
this.getTemplate("p21").spawn(this.numPages, false, false);
this.getTemplate("p22").spawn(this.numPages, false, false);
this.getTemplate("p23").spawn(this.numPages, false, false);
this.calculate = true;
}
} else if (P19!=-1) this.deletePages(P19, P19+4);
}
Field "P19Marker" is used to ID the Starting page. The remaining 4 pp also contain their own unique 'Marker' fields.
Any help as to why the pages spawn on checkbox selection but do not delete when unselected is greatly appreciated- thanks in advance!
This topic has been closed for replies.

1 reply

Bernd Alheit
Community Expert
Community Expert
August 4, 2023

Any error message in the Javascript console? 

Inspiring
August 4, 2023

none