# Show/Hide switch with msg.payload

**URL:** <https://discourse.nodered.org/t/show-hide-switch-with-msg-payload/16066>\
**Category:** Dashboard\
**Created:** [29 September 2019 18:30 UTC](https://discourse.nodered.org/t/show-hide-switch-with-msg-payload/16066 "2019-09-29T18:30:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicedevil](https://avatars.discourse-cdn.com/v4/letter/n/858c86/32.png) [@nicedevil](https://discourse.nodered.org/u/nicedevil)\
**Post date:** [29 September 2019 18:30 UTC](https://discourse.nodered.org/t/show-hide-switch-with-msg-payload/16066/1 "2019-09-29T18:30:19Z")

</div>

Hey guys,

I think my original Post under General was in the wrong place. So here again 🙂

Is it possible to Show/Hide a switch with a msg.payload or anything else?  
I just want to enter a PIN before I'm able to turn on or off a switch for a few seconds after I entered the correct PIN.

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [29 September 2019 18:37 UTC](https://discourse.nodered.org/t/show-hide-switch-with-msg-payload/16066/2 "2019-09-29T18:37:28Z")

</div>

No you can’t easily show/hide it. But you can disable and enable it.

---

<div class="post-metadata">

**Author:** ![nicedevil](https://avatars.discourse-cdn.com/v4/letter/n/858c86/32.png) [@nicedevil](https://discourse.nodered.org/u/nicedevil)\
**Post date:** [29 September 2019 19:01 UTC](https://discourse.nodered.org/t/show-hide-switch-with-msg-payload/16066/3 "2019-09-29T19:01:31Z")

</div>

Mhhh maybe that could be a solution as well 🙂  
Can you give me short example how to achive this?

I think I know how to change the color of a modified switch but not from the original/default ones.

If that is possible I could change the color to red if the PIN isn't entered and the switch is disabled?

---

<div class="post-metadata">

**Author:** ![nicedevil](https://avatars.discourse-cdn.com/v4/letter/n/858c86/32.png) [@nicedevil](https://discourse.nodered.org/u/nicedevil)\
**Post date:** [29 September 2019 19:15 UTC](https://discourse.nodered.org/t/show-hide-switch-with-msg-payload/16066/4 "2019-09-29T19:15:17Z")

</div>

Ah ok... found it out by myself after reading the information for the switch node till the end 😃  
 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/3/31a48603b01364561f1510387b921bf32373f805.png)

So because it is faded it out a bit the feature with color the switch red or normal isn't needed anymore \<3

Thank you very much!

---

<div class="post-metadata">

**Author:** ![Squirrelbd](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/squirrelbd/32/13451_2.png) [@Squirrelbd](https://discourse.nodered.org/u/Squirrelbd)\
**Post date:** [11 October 2020 20:13 UTC](https://discourse.nodered.org/t/show-hide-switch-with-msg-payload/16066/5 "2020-10-11T20:13:26Z")

</div>

Can you please share an example flow?

---

<div class="post-metadata">

**Author:** ![hbull1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hbull1/32/28929_2.png) [@hbull1](https://discourse.nodered.org/u/hbull1)\
**Post date:** [19 October 2020 16:02 UTC](https://discourse.nodered.org/t/show-hide-switch-with-msg-payload/16066/6 "2020-10-19T16:02:46Z")

</div>

@Squirrelbd I was just able to get it to work with this example

```auto
[{"id":"9ecb7341.656e","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"9afd158c.c9dc58","type":"ui_dropdown","z":"9ecb7341.656e","name":"","label":"","tooltip":"","place":"Select option","group":"adddc3f9.8fb54","order":2,"width":0,"height":0,"passthru":true,"multiple":false,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"","x":750,"y":520,"wires":[[]]},{"id":"26248949.1fe1b6","type":"change","z":"9ecb7341.656e","name":"","rules":[{"t":"set","p":"enabled","pt":"msg","to":"false","tot":"bool"},{"t":"set","p":"options","pt":"msg","to":"[\"option1\",\"option2\",\"option3\"]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":400,"wires":[["803da111.ebebe","9afd158c.c9dc58"]]},{"id":"803da111.ebebe","type":"delay","z":"9ecb7341.656e","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":540,"y":400,"wires":[["a44722b.9ca4be"]]},{"id":"8e8c5927.251188","type":"inject","z":"9ecb7341.656e","name":"Press Me","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":400,"wires":[["26248949.1fe1b6"]]},{"id":"a44722b.9ca4be","type":"change","z":"9ecb7341.656e","name":"","rules":[{"t":"set","p":"enabled","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":400,"wires":[["9afd158c.c9dc58"]]},{"id":"ad6e2dee.8b78c","type":"comment","z":"9ecb7341.656e","name":"Dropdown greyed/disabled until delay timer completes","info":"","x":240,"y":360,"wires":[]},{"id":"adddc3f9.8fb54","type":"ui_group","z":"","name":"Test","tab":"321a0aed.9d57e6","order":1,"disp":true,"width":"6","collapse":false},{"id":"321a0aed.9d57e6","type":"ui_tab","z":"","name":"Test","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [19 October 2020 17:21 UTC](https://discourse.nodered.org/t/show-hide-switch-with-msg-payload/16066/7 "2020-10-19T17:21:11Z")

</div>


