SubForm's Loop and hiding based on checkbox



I have a form where sub forms have a check box in them.  I need a script when the user clicks a button to hide all sub forms that don't have the check box checked.  Thanks for any assistance you can provide.

var allChildElements;

var intNumElements;

var currentElement;

var i;

allChildElements = CRT130.nodes;

intNumElements = allChildElements.length;

for (i=0; i<intNumElements; i++)


currentElement = allChildElements.item(i);

if(currentElement.className === "checkbox")


  if(currentElement.rawValue == 0)


  currentElement.presence = "hidden";





Accepted Solutions (1)

Accepted Solutions (1)




Hi there,

the className of a checkbox is "field", if you want to verify if the item is a checkbox, you have to access to the ui's field to be able to verify what kind of field it is.

Although for a checkbox the className is checkButton instead of checkbox.

You would need to create a recursive function to loop through each subform and also each items within the subform.

Create a script object (xfaCheckBoxes) with the function above within, and then you can call the function on the button's click event

This should do the trick,

I hope it will help!