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 changes background color with selected option

Avatar

Level 3

Hi there!

I´m stuck with this DropDown which I need to have a red background if the option TBD is active (which is the default option) and to have no backgrond if any other option is selected.

drop01.png

drop02.png

drop03.png

The red background is a red rectangle that it is visible or hidden, I have tthis code in the change event of the DropDown:

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

    RectangleRed2.presence = "visible";

}else{

    RectangleRed2.presence = "hidden";

}

But the thing is that the event checks the value when is changed, so if I am in TBD value and I selec Item 1, the recntagle is still visible, because at the moment I selected the Item 1 the value was TBD,  so is not working the way I need it to.

Anys Ideas?

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 5

You have to use

if (xfa.event.newText == "TBD"){

...

Then it works fine.

"xfa.event.newText" takes the dropdown value at the runtime.

Hope, it's helpful,

Mandy

View solution in original post

2 Replies

Avatar

Correct answer by
Level 5

You have to use

if (xfa.event.newText == "TBD"){

...

Then it works fine.

"xfa.event.newText" takes the dropdown value at the runtime.

Hope, it's helpful,

Mandy