Avatar

Level 2

I still can't seem to get it to work. When I select 'copy this section' it just inserts a blank instance. In case I didn't explain it correctly when a user inserts an instance they are actually inserting a new instance of the ACT table which has a header, footer and nine rows of data.

Also I think I have done something wrong and am throwing the instance manager out of sync when selecting the other choices.

Here is my updated script.

var cChoice = app.popUpMenu("Insert a blank section above", "Insert a blank section below", "Copy this section", "-", "Delete this section");

if (cChoice == "Delete this section"){
_ACT.removeInstance(ACT.instanceIndex);
xfa.form.recalculate(1);
}
else if
(cChoice == "Insert a blank section below"){
var RowCount = _ACT.count - 1
_ACT.addInstance(RowCount + 1);
xfa.form.recalculate(1);
}
else if
(cChoice == "Insert a blank section above"){
var RowCount = _ACT.count - 1
_ACT.addInstance(RowCount);
xfa.form.recalculate(1);
}
else
{
_ACT.addInstance(ACT.instanceIndex);
var vRowCount = _ACT.instanceIndex - 1
var i=0;
    for (i=1;i<=vRowCount;i++)    
    { 
    xfa.resolveNode("form1.#subform.ACT[" + (i-1) + "].AssetClass").rawValue = xfa.resolveNode("form1.#subform.ACT.Row1").AssetClass.rawValue
}
}