How to control objects presence through a drop down list selection?

charlierobledo

28-09-2018

Hi,

I have a drop-down list that has about 30 items. I know you can create an action to show an object when certain text in the drop down is selected. However, the object does not go back to "hidden" when other text is selected in the drop-down list. How can I make it so the object appears only when certain items are selected and the rest make it go back to hidden? Is there an easy script for this?

Thanks

View Entire Topic

mouslander

10-10-2018

you would need to have a second action. For example if you have Apple, Banana, Orange and the user selects Banana and a field is displayed (visible) but when the select Orange the field that displayed for Banana is now hidden.

You would need something like"

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

field1.presence = "visible"

}

else{

field1.presence = "hidden"

}

This could be a mess if you have 30 fields in the drop down and each would have its own hidden field. Another way to do this is to use one field and dynamically change the field value for example:

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

field1.presence = "visible"

field1.rawValue = "I love Banana"

}

else

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

field1.presence = "visible"

field1.rawValue = "Oranges are good for you"

}

An even cleaner way to do this is with a case statement.