Search code examples
javascriptrepeatlivecyclesubforms

Adobe LiveCycle working with Repeating Subforms


I have repeating subforms with buttons on them. I want to be able to remove buttons that have been added with each addition of a subform. By the searching I've done, the following code should work, but it doesn't. Can someone please set me straight?

var IGdelbut = xfa.resolveNodes("ItemGroup[*].ItemHeader.Delbutton");
for (var i = 0; i < IGdelbut; i++) {
    IGdelbut.presence = "invisible";
}

(I apologize for repeating my earlier question, but I'm hoping I'm giving someone better information to work with.)


Solution

  • Your script has a couple of issues iterating over the result of resolveNodes() call. If i get this right, you are trying to hide all the *DelButton*s on the subforms.

    Try the following

    var allDeleteButtons = xfa.resolveNodes("ItemGroup[*].ItemHeader.Delbutton");
    var len = allDeleteButtons.length;
    for (var i = 0; i < len; i++) {
        allDeleteButtons.item(i).presence = "invisible";
    }
    

    Assuming you have this script on the parent subform of repeating ItemGroup subforms.