Avatar

Level 4

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!