Looping through subforms to hide subforms containing an unchecked Checkbox



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:


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";}


               curRow.presense = "visible";}



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


Any guidance on this would be greatly appreciated!

Accepted Solutions (1)

Accepted Solutions (1)

Answers (6)

Answers (6)




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



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.