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

Changing the color of Buttons back and forth

yoyo112673
Level 3
Level 3

Hi,

I've created a form and I have placed a button that I need to change color and text once clicked. The problem I have is that I want to make a second click to make the button go back to the previous state. So, basically the button should have two "stages". At first it should appear white and the caption on it should read something, and once I click, the color and caption should change but I want to be able to make go back to its original state by cliking on it once again.

I have used the following code under the "click" function but it only works one way.

this.resolveNode("caption.value.#text").value = "Available";
this.fillColor = "55,55,55";

Thank you for your help!!!!!

0 Replies
Varma_LC
Level 6
Level 6

try the following....

if

(this.resolveNode("caption.value.#text").value != "Available") {

     this.resolveNode("caption.value.#text").value

= "Available";

     this.fillColor

= "55,55,55";

}

else {

     this.resolveNode("caption.value.#text").value

= "NotAvailable";

     this.fillColor

= "255,255,255";

}