I could use some help sorting out this click event. I can't seem to get it to work the way I need it too. I have tried a few different variations with no success. The part I am having trouble with is in the loop and inserting multiple copies based on user input from the app.response event. I have a version of script that works with no loop but that won't allow functionality for inserting multiple instances of the subform. Would appreciate any help figuring out how I can do this.
var cChoice = app.popUpMenu("Add a blank section", "Copy this section", "-", "Delete this section");
if(cChoice == "Add a blank section"){
ACT.instanceManager.addInstance(1)
} else if(cChoice == "Delete this section"){
ACT.instanceManager.removeInstance(this.parent.instanceIndex)
}else if(cChoice == "Copy this section"){
var cResponse = app.response("How many instances of this section would you like to insert?",["Copy current section",])
}
if (cResponse == null)
{
app.alert("No copy of the current section was inserted due to a null response.");
}
else
{
var i=ACT.instanceIndex
var j=0
while(j<cResponse)do
{
_ACT.addInstance(1)
xfa.resolveNode("form1.Subform1.ACT[" +(i+1) + "].Row1.textField").rawValue = xfa.resolveNode("form1.Subform1.ACT.Row1.textField").rawValue