I'm trying to use AEM Forms addInstance() method inside a MasterPage to instantiate multiple times, via a for loop, a subform (placed outside the Master Page). The result is that it calls the document multiple times, it goes into an infinite loop. Is it not possible to use addInstance() in this way in a MasterPage??
Solved! Go to Solution.
In a template I have to import a fragment. In this fragment I want to create several instances of a subform and for each of these I check if the number of pages of the fragment has changed as the number of instances of the subform increases. For example, if after 5 iterations the fragment from 1 page goes to 2 pages I have to hide an element that is on the first page and modify another element that is on the next page.
I thought about using the master page because from here I could read the value of xfa.layout.page (this), but I had to put the rest of the code (the loop with addInstance()) inside it too