Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Dropdown menu selections canceling themselves out

Avatar

Level 3

Another dropdown issue. I have selection choice result canceling themselves out?

Is there a way to avoid this?

DD1 is the dropdown menu
TF(*) are just text fields

If(DD1.rawValue == "1")

{

TF1.presence = "visible"; TF2.presence = "visible"; TF3.presence = "visible";

}

else

{

TF1.presence = "hidden"; TF2.presence = "hidden"; TF3.presence = "hidden";

}

If(DD1.rawValue == "2")

{

TF2.presence = "visible"; TF3.presence = "visible"; TF4.presence = "visible";

}

else

{

TF2.presence = "hidden"; TF3.presence = "hidden"; TF4.presence = "hidden";

}

When I select "1" only TF1 shows

when I select "2" TF2, TF3, and TF4

For selection "1" TF2 and TF3 is being cancelled out? If so, then in selection "2", shouldn't only TF4 show up?

If there a solution here?

Thank you advance

1 Accepted Solution

Avatar

Correct answer by
Level 7

When I have done this type of thing I have found else scripts a little unreliable. The thing is, in this case it isnt needed at all, just put everything in the if statement. Hide and show objects in one place. It will work this way.

Eg

If(DD1.rawValue == "1") //when 1 is selected, show TF1, 2 and 3 but not 4

{

TF1.presence = "visible";

TF2.presence = "visible";

TF3.presence = "visible";

TF4.presence = "hidden";

}

If(DD1.rawValue == "2") //when 2 is selected, show TF2, 3 and 4 but not 1

{

TF1.presence = "hidden";

TF2.presence = "visible";

TF3.presence = "visible";

TF4.presence = "visible";

}

View solution in original post

3 Replies

Avatar

Correct answer by
Level 7

When I have done this type of thing I have found else scripts a little unreliable. The thing is, in this case it isnt needed at all, just put everything in the if statement. Hide and show objects in one place. It will work this way.

Eg

If(DD1.rawValue == "1") //when 1 is selected, show TF1, 2 and 3 but not 4

{

TF1.presence = "visible";

TF2.presence = "visible";

TF3.presence = "visible";

TF4.presence = "hidden";

}

If(DD1.rawValue == "2") //when 2 is selected, show TF2, 3 and 4 but not 1

{

TF1.presence = "hidden";

TF2.presence = "visible";

TF3.presence = "visible";

TF4.presence = "visible";

}

Avatar

Level 3

Again Brilliant! This works for me!

Thank you!