Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Hiding multipe instances of a subform

Avatar

Not applicable
Hi there,



Scenario: The user clicks 'Another Address' button to create previous address subforms of which there can be up to ten. When the user navigates to another part of the form the previous address subforms should hide. As I expected, the following script only hides one of the instances:



form1.pg1.sPrevAddress.presence = "hidden";



I tried:



for (int i = 0; i < sPrevAddress.count; i++)

{

form1.pg1.sPrevAddress[i].presence = "hidden";

}



but this didn't work.



I would be greatful for some guidance.



Thanks,



Kieran
1 Reply

Avatar

Level 10
Each subform gets an instance number. You can address each individual subform by using form1.pg1.sPrevAddress[instancenumber].presence



To get the number of subforms you can use the form1.pg1.sprevAddress.instanceManager.count