Skip to main content
Inspiring
May 7, 2024
Answered

How to hide fields based on dropdown value

  • May 7, 2024
  • 1 reply
  • 1487 views

Hi, I have different kind of field I would like to hide based on a dropdown selection. There is one image : "Image1"; two buttons : "Button1" and "Button2"; ont text field : "Text8"; two checkboxes on the same name : "CB1". There is three option in the dropdown : 1, 2, 3. I would like to know what is the code to make all the field dissapear if 3 is selected. 

Thank you.

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

As validate script of dropdown you can use this:

if(event.value == "3"){
this.getField("Image1").display = display.hidden;
this.getField("Button1").display = display.hidden;
this.getField("Button2").display = display.hidden;
this.getField("CB1").display = display.hidden;}

You may also add condition to show fields.

1 reply

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
May 7, 2024

As validate script of dropdown you can use this:

if(event.value == "3"){
this.getField("Image1").display = display.hidden;
this.getField("Button1").display = display.hidden;
this.getField("Button2").display = display.hidden;
this.getField("CB1").display = display.hidden;}

You may also add condition to show fields.

Inspiring
May 7, 2024

Thank you, it works.

Inspiring
May 7, 2024

However, it doesn't work for checkboxes.