# Problems updating ui-lable on Button

**URL:** <https://discourse.nodered.org/t/problems-updating-ui-lable-on-button/96750>\
**Category:** Dashboard\
**Tags:** dashboard-2\
**Created:** [25 April 2025 09:10 UTC](https://discourse.nodered.org/t/problems-updating-ui-lable-on-button/96750 "2025-04-25T09:10:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![juntiedt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/juntiedt/32/58357_2.png) [@juntiedt](https://discourse.nodered.org/u/juntiedt)\
**Post date:** [25 April 2025 09:10 UTC](https://discourse.nodered.org/t/problems-updating-ui-lable-on-button/96750/1 "2025-04-25T09:10:52Z")

</div>

I want to change the color and the lable text based on the input "on" and "off".  
The color change works but not the lable change.  
What is the problem?

```auto
let state = msg.payload.state;
msg.ui_update = {}
if (state === "ON") {
    msg.ui_update.label = "EGWZ-TV ON";
    node.send(msg);
    msg.ui_update.textColor = "red";
    return msg;
};

if (state === "OFF"){
    msg.ui_update.lable = "EGWZ-TV OFF";
    node.send(msg);
    msg.ui_update.textColor = "white";
    return msg;
};

```

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [25 April 2025 09:28 UTC](https://discourse.nodered.org/t/problems-updating-ui-lable-on-button/96750/2 "2025-04-25T09:28:23Z")

</div>

You have a typo in the `if(state === "OFF")` block (and this post title), `lable` should be `label`.

---

<div class="post-metadata">

**Author:** ![juntiedt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/juntiedt/32/58357_2.png) [@juntiedt](https://discourse.nodered.org/u/juntiedt)\
**Post date:** [25 April 2025 09:58 UTC](https://discourse.nodered.org/t/problems-updating-ui-lable-on-button/96750/3 "2025-04-25T09:58:06Z")

</div>

Hi Budd,  
thanks for the quick response!  
I changed lable but it still does not change the text.

```auto
msg.ui_update = {};

node.warn(msg.payload.state)

if (msg.payload.state === "ON") {
    msg.ui_update.textColor = "red";
    node.send(msg);
    msg.ui_update.lable = "EGWZ-TV ON";
    return msg;
};

if (msg.payload.state === "OFF"){
    msg.ui_update.textColor = "white";
    node.send(msg);
    msg.ui_update.lable = "EGWZ-TV OFF";
    return msg;
};

```

---

<div class="post-metadata">

**Author:** ![juntiedt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/juntiedt/32/58357_2.png) [@juntiedt](https://discourse.nodered.org/u/juntiedt)\
**Post date:** [25 April 2025 10:35 UTC](https://discourse.nodered.org/t/problems-updating-ui-lable-on-button/96750/4 "2025-04-25T10:35:54Z")

</div>

all ok now.  
many  
thanks!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [9 May 2025 10:36 UTC](https://discourse.nodered.org/t/problems-updating-ui-lable-on-button/96750/5 "2025-05-09T10:36:28Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
