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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

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

Sounet
Level 1
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
_Bruce_Robertson
Level 10
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

Sounet
Level 1
Level 1

Hi Bruce,

Thank you, that worked great.

Regards

Sou