add instance in a subform which also can be doubled

Avatar

09-10-2008

Hi,



I have a subform X which can be doubled by a click on the button. In that subform X there is another subform Y which also can be multiplied to a maximum of 3.



Now when I add a subform X and i want to add some subforms Y. The form will only add the subform Y in the first subform X and not in the second one.



This is the script I use:



for subform x



if(Incitant52.subFoireAcheteur.all.length < 2){;

Incitant52.subFoireAcheteur.instanceManager.addInstance(true);

}



and for subform y



if(Incitant52.subFoireAcheteur.subAcheteur.all.length < 3){;

Incitant52.subFoireAcheteur.subAcheteur.instanceManager.addInstance(true);

}

Replies

Avatar

Avatar

pguerett

Avatar

pguerett

pguerett

09-10-2008

To add instances to the second occurance of subform x you will need to address it with subformx[1].



Note that the [ ] brackets are not valid in javascript so your expression should look something like this:



xfa.resolveNode("Incitant52.subFoireAcheteur.subformx[1]").instanceManager.addInstance(1)

Avatar

09-10-2008

Thanks for the help. I already tried to change the script but my designer always crashes.



But I can keep it in javascript?



Can i also use the brackets with javascript for a calculation?

Avatar

Avatar

pguerett

Avatar

pguerett

pguerett

09-10-2008

Yes ...but again you will have to use the xfa.reolveNode syntax to address the correct instance.