# Change UI\_Switch status (true or false) at Runtime

**URL:** <https://discourse.nodered.org/t/change-ui-switch-status-true-or-false-at-runtime/12372>\
**Category:** Dashboard\
**Created:** [18 June 2019 18:31 UTC](https://discourse.nodered.org/t/change-ui-switch-status-true-or-false-at-runtime/12372 "2019-06-18T18:31:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ylechasseur](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ylechasseur/32/6549_2.png) [@ylechasseur](https://discourse.nodered.org/u/ylechasseur)\
**Post date:** [18 June 2019 18:31 UTC](https://discourse.nodered.org/t/change-ui-switch-status-true-or-false-at-runtime/12372/1 "2019-06-18T18:31:47Z")

</div>

Hi,

After a query in Mysql, I display the data on regular UI\_textbox and I would like to use ui\_switch do display by boolean fields data.

So far, no success, the ui\_switch never change according to received field value (true or false). IF I use a timestamp and sending true or false manually, the switch status change on the site dynamically.

Any idea what wrong I do?

Thanks a lot for your help

Yves

Here the switch config:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/a/a4c2f34792d270a86edfd5354f3a4c0a1daf2eeb.png)

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [18 June 2019 18:39 UTC](https://discourse.nodered.org/t/change-ui-switch-status-true-or-false-at-runtime/12372/2 "2019-06-18T18:39:40Z")

</div>

Add a debug to check the message you are sending to the switch and check that msg.payload is set to true or false

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [18 June 2019 18:58 UTC](https://discourse.nodered.org/t/change-ui-switch-status-true-or-false-at-runtime/12372/3 "2019-06-18T18:58:35Z")

</div>

Particularly check whether it is boolean true or string "true"

---

<div class="post-metadata">

**Author:** ![ylechasseur](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ylechasseur/32/6549_2.png) [@ylechasseur](https://discourse.nodered.org/u/ylechasseur)\
**Post date:** [18 June 2019 19:10 UTC](https://discourse.nodered.org/t/change-ui-switch-status-true-or-false-at-runtime/12372/4 "2019-06-18T19:10:45Z")

</div>

Colin, thanks, it was "true" and not true !!

I will make proper corrections in mysql table for boolean values....

Thanks a lot .. it is very appreciated

Yves

---

<div class="post-metadata">

**Author:** ![ylechasseur](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ylechasseur/32/6549_2.png) [@ylechasseur](https://discourse.nodered.org/u/ylechasseur)\
**Post date:** [18 June 2019 19:16 UTC](https://discourse.nodered.org/t/change-ui-switch-status-true-or-false-at-runtime/12372/5 "2019-06-18T19:16:18Z")

</div>

Works just fine... Thanks a lot
