2 Replies Latest reply on Jun 13, 2014 2:17 PM by colt9302

    resolveNode and addInstance

    colt9302 Level 1

      what is the right syntax for something like this to work?


      var newInst = xfa.form.form1.resolveNode("#page[0]").instanceManager.addInstance(1);

        • 1. Re: resolveNode and addInstance
          colt9302 Level 1

          Hello everybody, I hope someone would be able to help me find a solution to my problem. I've been searching on the internet for the past 2 days with no avails.

          Using LiveCycle 8.2, I created a form that has 4 different dynamic subforms, all named "page" :

          page[0]

          page[1]

          page[2]

          page[3]

           

          I want to keep that naming convention if possible, for sake of simplicity of programming, I will used resolveNodes to create a collection of certains objects in all the dynamic subforms, ie, using instructions like this : var collDances = xfa.form.form1.resolveNodes("page[*].table[*].row[*].dance[*]");, etc. Here lies the problem maybe.

           

          On a separate subform (named "summary"), I created 4 buttons to instanciate each one of those dynamic subforms specifically, with instructions like this :

          button[0] ::click  var newInst = xfa.form.form1.resolveNode("_page[0]").addInstance(0);

          button[1] ::click  var newInst = xfa.form.form1.resolveNode("_page[1]").addInstance(0);

          button[2] ::click  var newInst = xfa.form.form1.resolveNode("_page[2]").addInstance(0);

          button[3] ::click  var newInst = xfa.form.form1.resolveNode("_page[3]").addInstance(0);


          Everything works fine for creating all the subforms dynamically, using Acrobat or Reader, (with 4 different subforms, each one of them could be created more than once if need be) and even removing them specifically. However, if I save the form and reopen it, only the first subform ("page[0]") is displayed in the form, for each subforms that were created, ie, if there were 4 different subforms created in the form, there are now only 4 "page[0]" subform (the first subform) in the form and none of the others (???). I renamed the subforms to specific different names and everything works fine, but now I have to either change my programming to access those same subforms that have now different name, or figure out what's happening with the dynamic subforms when they're all named the same, with an occurrence number between brackets. Remember, everything works fine for creating and deleting, it's only when I save the form (and then reopen it) that now I have lost all the other subforms... I'm hoping that someone coud help me to undertand what's going on and possibly find a solution. I think I should be able to keep the naming convention that I choose as I feel it is a more natural way of doing things considering the expected end result.

          • 2. Re: resolveNode and addInstance
            colt9302 Level 1

            my solution for now (for whomever is interested) :

             

            var collDances = xfa.resolveNodes("form.form1.*..table[*].row[*].dance[*]");