Im currently implement a function which expand all the subforms when user clicks on ExpandAll but there is something really wierd happening and i will try my best to make it clear.
The Structure of the Form is like this
this is the code i try to retrieve a list of subform
var subFormCollection = Application.nodes ;
var subFormsLength = Application.nodes.length;
lets say The application has 9 subforms so the length is 9 which is correct.
this is the problem: When i try to add instance of the subform at each index it failed. e.g subFormCollection.item(i).SetInstance(1);
This is because the object can be einther "INstanceManger" or "subform" object. SetInstance() method work fine with InstanceManger but not with subform object.
At first i thougth the list only contains SubForm object however when i debugged it i have discover that it also include "InstanceManger" object of each subform in the list. for example: lets say the name of subform is "StartUpQuestion" when i try to retrieve the list it also contain "_StartUpQuestion" with the underscore at the fornt. This cause the length of subforms to decrease by half because of the instanceManager object for each subform. This prevent me to access the subform beyond the length.
ANyone have any idea why it like that? or do you have a better way to get a list of Subforms ?? I would appricate any helps. thanks