Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Dropdown menu selections canceling themselves out

shawnFMU
Level 3
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
MinusZero
Correct answer by
Level 7
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

0 Replies
MinusZero
Correct answer by
Level 7
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

shawnFMU
Level 3
Level 3

Again Brilliant! This works for me!

Thank you!