Skip to main content
Lea.V
Participant
March 28, 2023
Answered

Show/hide certain check boxes based on drop down selection

  • March 28, 2023
  • 1 reply
  • 1741 views

Hello, I need help with making certain check boxes visible/hidden based on a drop down selection. As you can see from the screenshot, I only want the check boxes on the side to be visible to mark off if I choose a value in the Account Type field since not all check boxes will be needed. Please help! this is the last thing I need to complete this form 🙂

This topic has been closed for replies.
Correct answer Nesa Nurani

There was an error in a script I posted, it's fixed now.

You can add another choice like this:

if(event.value == "Choice1"){
this.getField("Checkbox1").display = display.visible;
this.getField("Checkbox2").display = display.visible;
this.getField("Checkbox3").display = display.visible;
this.getField("Checkbox4").display = display.hidden;
this.getField("Checkbox5").display = display.hidden;}

else if(event.value == "Choice2"){
this.getField("Checkbox1").display = display.visible;
this.getField("Checkbox2").display = display.visible;
this.getField("Checkbox3").display = display.hidden;
this.getField("Checkbox4").display = display.hidden;
this.getField("Checkbox5").display = display.hidden;}

 

 

1 reply

Nesa Nurani
Community Expert
Community Expert
March 29, 2023

You can use 'display' property and set checkboxes to 'visible' or hidden' depending on dropdown choices, something like this:

if(event.value == "Choice1"){
this.getField("Checkbox1").display = display.visible;
this.getField("Checkbox2").display = display.visible;
this.getField("Checkbox3").display = display.visible;
this.getField("Checkbox4").display = display.hidden;
this.getField("Checkbox5").display = display.hidden;}

Lea.V
Lea.VAuthor
Participant
March 29, 2023

Thank you Nesa! How would I go on with the other choices? My issue now is that the other selections from the drop down is no longer generating nor will it let me select the other choices from the list. It seems like it's stuck. Can you show me an example of adding Choice2 as well? Just to make sure, this script should be in the custom calcuation script, correct?

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
March 29, 2023

There was an error in a script I posted, it's fixed now.

You can add another choice like this:

if(event.value == "Choice1"){
this.getField("Checkbox1").display = display.visible;
this.getField("Checkbox2").display = display.visible;
this.getField("Checkbox3").display = display.visible;
this.getField("Checkbox4").display = display.hidden;
this.getField("Checkbox5").display = display.hidden;}

else if(event.value == "Choice2"){
this.getField("Checkbox1").display = display.visible;
this.getField("Checkbox2").display = display.visible;
this.getField("Checkbox3").display = display.hidden;
this.getField("Checkbox4").display = display.hidden;
this.getField("Checkbox5").display = display.hidden;}