Delete spawned page depending on dropdown choice
I have a 2 page document that contains 2 hidden templates.
I have a 'Title' dropdown field at the top of page 1 which has 3 options. Options 1 and 3 will each spawn an additional page at the end of the document.
This works perfectly.
The issue comes if someone decided to change the 'Title'. For instance, if they had originally picked Option 1, the corresponding page will spawn for this. If they then change to Option 3, the page for this will spawn.
What I would like to happen is have the spawned page disappear if a different option in the Title field is chosen.
Is this possible?
This is the code that is in the Title drop down to spawn the pages:
if(event.value == "Abonnement Service Intégral")
this.getTemplate("Option1").spawn(this.numPages, false, false);
else if(event.value == "Abonnement Connect – RH")
this.getTemplate("Option3").spawn(this.numPages, false, false);
