Expand my Community achievements bar.

How do I hide a list of items that are not selected (check boxes)?

Avatar

Level 1

I have form with many items that I would like them to hide if they are not selected, before printing for example or just to clear them off.

3 Replies

Avatar

Level 10

Hi,

If all your checkboxes are under the same subform (called Subform1 in this case) you can use a script like the following in the prePrint event.


var checkboxes = Subform1.resolveNodes('#field.[ui.oneOfChild.className == "checkButton" and $ == 0]');


for (var i = 0; i < checkboxes.length; i++)


{


checkboxes.item(i).presence = "hidden";


}


and then make them visible in the postPrint event;


var checkboxes = Subform1.resolveNodes('#field.[ui.oneOfChild.className == "checkButton" and $ == 0]');


for (var i = 0; i < checkboxes.length; i++)


{


checkboxes.item(i).presence = "visible";


}


Regards

Bruce

Avatar

Level 1

Hello,

I tried this script on the check boxes that I wanted the action to apply; keeping in mind your suggestion for the prePrint event

if (this.rawValue == "0") {

  this.resolveNode("$").presence = "hidden";

}

And for the postPrint

if (this.rawValue == "0") {

  this.resolveNode("$").presence = "visible";

}

Thanks a lot for your suggestion and idea.