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
BedrockMission!

Learn More

View all

Sign in to view all badges

Hidden and Visible on Add Instance Object

Avatar

Avatar
Validate 10
Level 1
shawnFMU
Level 1

Like

1 like

Total Posts

38 posts

Correct Reply

1 solution
Top badges earned
Validate 10
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 10
Level 1
shawnFMU
Level 1

Like

1 like

Total Posts

38 posts

Correct Reply

1 solution
Top badges earned
Validate 10
Validate 1
Boost 1
Affirm 1
View profile
shawnFMU
Level 1

15-06-2020

I have an object that will increase by one with an Add Instance button.

I have a check box that will toggle hidden/visible.

Only the first instance can be hidden/visible... why not the rest?

 

check box / click: 

if(this.rawValue == "1")
{

form1.P1.wrap.textfield2[*].presence = "hidden";

}

 

I tried to loop it:

if(this.rawValue == "1")
{
for (var i = 0; i < xfa.host.numPages; i++){var oSubform = xfa.resolveNode("form1.P1[" + i + "]");oSubform.wrap.textfield2.presence = "hidden";}
}

 

Help!

Thank you in advance

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

395 likes

Total Posts

2,686 posts

Correct Reply

491 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

395 likes

Total Posts

2,686 posts

Correct Reply

491 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
radzmar
MVP

17-06-2020

You're addressing the fields the wrong way. 

I' guessing that the subform "wrap" is the one, that contains the textfield and is going to be repeated, right?

The loop than should look this way: 

 

var cSel = this.rawValue,
	oFields = xfa.resolveNodes("form1.P1.wrap[*].textfield2"), // wrap[*] means every instance of the subfom wrap. 
	i;

for (i = 0; i < oFields.length; i += 1) {
	oFields.item(i).presence = cSel == "1" ? "visible" : "hidden";
}

 

Answers (0)