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

Looping through subforms to hide subforms containing an unchecked Checkbox

Avatar

Avatar
Validate 10
Level 2
joflo723
Level 2

Likes

4 likes

Total Posts

114 posts

Correct Reply

3 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
Affirm 3
View profile

Avatar
Validate 10
Level 2
joflo723
Level 2

Likes

4 likes

Total Posts

114 posts

Correct Reply

3 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
Affirm 3
View profile
joflo723
Level 2

22-10-2018

Hi all! I am stuck and would love a little help. I have a form with about 5 levels of subforms. I'm trying run a script with a button click that loops through each subform and hides any subforms that contain an unchecked Checkbox. Here is my hierarchy:

2018-10-22_66.png

So far, I've created a script object called "hide" that has this:

function ToggleRows(reset){

     var Rows = form1.page1.middle.ADDITIONS.EMR.Checkboxes.cb.all;

     var curRow;

     for (var i=0; i<Rows.length; i++){

          curRow = Rows.item(i);

          if (curRow.cb.rawValue == 1){

               curRow.presense = "hidden";}

          else{

               curRow.presense = "visible";}

     }

}

My button is in the "top" subform, and contains this text:

hide.ToggleRows(reset);

Any guidance on this would be greatly appreciated!

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile
_Bruce_Robertson
MVP

23-10-2018

Hi

As well as the presense thing, what is reset.  You pass it in but never use it.  Try just hide.ToggleRows();

Answers (6)

Answers (6)

Avatar

Avatar
Validate 1
Level 4
MinusZero
Level 4

Likes

30 likes

Total Posts

326 posts

Correct Reply

54 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Validate 1
Level 4
MinusZero
Level 4

Likes

30 likes

Total Posts

326 posts

Correct Reply

54 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile
MinusZero
Level 4

23-10-2018

Good tip. You can also show the console any time by pressing CTRL+J

Avatar

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile
_Bruce_Robertson
MVP

23-10-2018

Good news.  Make sure you have "Show console on errors and messages" set in Acrobat, under Edit ... Preferences ... JavaScript as you should have seen a "reset is not defined" message

Avatar

Avatar
Validate 10
Level 2
joflo723
Level 2

Likes

4 likes

Total Posts

114 posts

Correct Reply

3 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
Affirm 3
View profile

Avatar
Validate 10
Level 2
joflo723
Level 2

Likes

4 likes

Total Posts

114 posts

Correct Reply

3 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
Affirm 3
View profile
joflo723
Level 2

23-10-2018

Removing "reset" appears to have fixed it! Thank you both for all your help!

Avatar

Avatar
Validate 1
Level 4
MinusZero
Level 4

Likes

30 likes

Total Posts

326 posts

Correct Reply

54 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Validate 1
Level 4
MinusZero
Level 4

Likes

30 likes

Total Posts

326 posts

Correct Reply

54 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile
MinusZero
Level 4

22-10-2018

Just some thoughts....

You could also try specifically naming your subforms rather than using the autonumbering when the same name is used. I found that the number in square brackets in an object name interfered with the reference to an instance which is also a number in square brackets.

Eg: instead of cb[1], have cb1 etc

Using resolveNode has also fixed some issues i have had as well with subforms.

Avatar

Avatar
Validate 10
Level 2
joflo723
Level 2

Likes

4 likes

Total Posts

114 posts

Correct Reply

3 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
Affirm 3
View profile

Avatar
Validate 10
Level 2
joflo723
Level 2

Likes

4 likes

Total Posts

114 posts

Correct Reply

3 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
Affirm 3
View profile
joflo723
Level 2

22-10-2018

Oh good catch! Made that correction, but unfortunately no...still not working.

Avatar

Avatar
Validate 1
Level 4
MinusZero
Level 4

Likes

30 likes

Total Posts

326 posts

Correct Reply

54 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Validate 1
Level 4
MinusZero
Level 4

Likes

30 likes

Total Posts

326 posts

Correct Reply

54 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile
MinusZero
Level 4

22-10-2018

Hi,

Is this the problem? There is a typo in your code:

presense should be presence