Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

how to hide subform with index

Avatar

Former Community Member

Hi all,

i have 3 subform named as :

     1. Receipt_subform[0]

     2. Receipt_subform[1]

     3. Receipt_subform[2]

I am currently only showing Receipt_subform[0] and hide Receipt_subform[1] and  Receipt_subform[2].

I will only will display the Receipt_subform[1] and Receipt_subform[2] open user click add new table function.

how can i show the Receipt_subform[1] and Receipt_subform[2] from javacript.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Jeeva,

You can do this but would need to resolve the nodes. This is because all three subforms have the same name "Receipt_subform". The [1] is a tag showing the instance, on a zero based numbering system.

If we assume that the three subforms and the button are in the same subform then the following should work (if they are not, then you would need to include the full reference):

xfa.resolveNode("Receipt_subform[" + 1 + "]").presence = "visible";

xfa.resolveNode("Receipt_subform[" + 2 + "]").presence = "visible";

You could do a loop, but it hardly seems worth it for just two objects.

I would recommend having a different name for each subform, as this will make it much easier to reference each one.

Hope that helps,

Niall

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi Jeeva,

You can do this but would need to resolve the nodes. This is because all three subforms have the same name "Receipt_subform". The [1] is a tag showing the instance, on a zero based numbering system.

If we assume that the three subforms and the button are in the same subform then the following should work (if they are not, then you would need to include the full reference):

xfa.resolveNode("Receipt_subform[" + 1 + "]").presence = "visible";

xfa.resolveNode("Receipt_subform[" + 2 + "]").presence = "visible";

You could do a loop, but it hardly seems worth it for just two objects.

I would recommend having a different name for each subform, as this will make it much easier to reference each one.

Hope that helps,

Niall