Expand my Community achievements bar.

How can I show or hide a subform if one of multiple checkboxes is checked?

Avatar

Level 1

Hi,

I have 8 check boxes and would like to show a subform if any one of the check boxes is checked and hide this subform when the check box is unchecked. How can I do that?

The action builder didn't work very well.

Thanks

Sou

2 Replies

Avatar

Level 10

Hi,

Can we assume that all the checkboxes are in the same subform and they have the default values for on and off (that is 1 and 0).

If so try the following JavaScript in the calculate event of the subform containing the checkboxes;

var checkBoxes = this.resolveNodes('#field.[ui.oneOfChild.className=="checkButton" and $ == 1]');

Subform2.presence = (checkBoxes.length > 0) ? "visible" : "hidden";

 

The first line gets a list of all the child fields that are checkboxes and have a value of 1 (or on).

The next line sets the presence of the subform (which I am calling Subform2) to visible if there is one or more set to true)

Regards

Bruce

Avatar

Level 1

Hi Bruce,

Thank you, that worked great.

Regards

Sou