# I would like to inquire about the dropdown node

**URL:** https://discourse.nodered.org/t/i-would-like-to-inquire-about-the-dropdown-node/89559
**Category:** Dashboard
**Created:** [17 July 2024 05:14 UTC](https://discourse.nodered.org/t/i-would-like-to-inquire-about-the-dropdown-node/89559 "2024-07-17T05:14:51Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Athurian](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@Athurian](https://discourse.nodered.org/u/Athurian)
#### Post date: [17 July 2024 05:14 UTC](https://discourse.nodered.org/t/i-would-like-to-inquire-about-the-dropdown-node/89559/1 "2024-07-17T05:14:51Z")

</div>

I would like to inquire about the dropdown node.

I am using a drop-down node. Is it possible to configure the data transmission method to allow transmission only when a button is pressed?

For the current dropdown, if you select it you will go straight to debug.  
I want to use this method to send a message only when the button is pressed after selecting the dropdown.

I would like to proceed with the above configuration. Is this possible?

---

<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: [19 July 2024 14:09 UTC](https://discourse.nodered.org/t/i-would-like-to-inquire-about-the-dropdown-node/89559/2 "2024-07-19T14:09:07Z")

</div>

You could use a node-red-contrib-queue-gate to queue the message, then release it from the queue when the button is pressed.

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [19 July 2024 14:48 UTC](https://discourse.nodered.org/t/i-would-like-to-inquire-about-the-dropdown-node/89559/3 "2024-07-19T14:48:41Z")

</div>

You could use a ui-button, but you have to move the payload to msg.topic and back again after.  
e.g.

```auto
[{"id":"5e55e0cd0953f847","type":"ui-dropdown","z":"d1395164b4eec73e","group":"9d83cd8b3d5ee33c","name":"","label":"Select Option:","tooltip":"","order":3,"width":0,"height":0,"passthru":false,"multiple":false,"chips":false,"clearable":false,"options":[{"label":"1","value":"1","type":"str"},{"label":"2","value":"2","type":"str"}],"payload":"","topic":"dropdown","topicType":"str","className":"","x":140,"y":180,"wires":[["ba7ce5e6ee8ad483"]]},{"id":"ba7ce5e6ee8ad483","type":"change","z":"d1395164b4eec73e","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"topic","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":180,"wires":[["22ca5be64623ebee"]]},{"id":"22ca5be64623ebee","type":"ui-button","z":"d1395164b4eec73e","group":"9d83cd8b3d5ee33c","name":"","label":"Submit","order":0,"width":0,"height":0,"emulateClick":false,"tooltip":"","color":"","bgcolor":"","className":"","icon":"","iconPosition":"left","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":480,"y":180,"wires":[["5bf347d340903bc9"]]},{"id":"5bf347d340903bc9","type":"change","z":"d1395164b4eec73e","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"topic","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":220,"wires":[["cde5a6749ffaae68"]]},{"id":"cde5a6749ffaae68","type":"ui-text","z":"d1395164b4eec73e","group":"9d83cd8b3d5ee33c","order":1,"width":0,"height":0,"name":"","label":"text","format":"{{msg.payload}}","layout":"row-spread","style":false,"font":"","fontSize":16,"color":"#717171","className":"","x":650,"y":220,"wires":[]},{"id":"9d83cd8b3d5ee33c","type":"ui-group","name":"Group1","page":"c694d0ebe0d2b702","width":"6","height":"1","order":1,"showTitle":true,"className":"","visible":"true","disabled":"false"},{"id":"c694d0ebe0d2b702","type":"ui-page","name":"Page1","ui":"1805777f90e92057","path":"/page1","icon":"home","layout":"grid","theme":"a965ccfef139317a","order":2,"className":"","visible":"true","disabled":"false"},{"id":"1805777f90e92057","type":"ui-base","name":"dashboard","path":"/dashboard","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false},{"id":"a965ccfef139317a","type":"ui-theme","name":"HN Theme","colors":{"surface":"#5c5c5c","primary":"#00fdff","bgPage":"#383838","groupBg":"#4f4f4f","groupOutline":"#858585"},"sizes":{"pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px"}}]

```

@joepavitt, If we can set payload of a button node to flow, global, etc why can we not set it to a msg property. Seems passing on a incoming payload has a use.

---

<div class="post-metadata">

### Author: ![joepavitt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/joepavitt/32/59722_2.png) [@joepavitt](https://discourse.nodered.org/u/joepavitt)
#### Post date: [19 July 2024 15:01 UTC](https://discourse.nodered.org/t/i-would-like-to-inquire-about-the-dropdown-node/89559/4 "2024-07-19T15:01:47Z")

</div>

> [@E1cid](#):
>
> If we can set payload of a button node to flow, global, etc why can we not set it to a msg property. Seems passing on a incoming payload has a use.

I don't really want to have the `button` node itself used as a state store. That's what Node-RED's context store's are for.

In Node-RED, `msg` is a live object that doesn't exist once dealt with. In Dashboard, we go against this pattern _slightly_ by having each node have a `msg` store so that we can revive state on refresh of a dashboard, but having this pattern of using the button as a temporary store is not something I could advocate

---

<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: [19 July 2024 15:24 UTC](https://discourse.nodered.org/t/i-would-like-to-inquire-about-the-dropdown-node/89559/5 "2024-07-19T15:24:31Z")

</div>

> [@E1cid](#):
>
> You could use a ui-button

I would say doing it that way is a bit of an anti-pattern. I think that ideally the UI should be kept distinct from the logic, embedding the logic in the ui node goes against this. Also, if the button is pressed twice won't that send the last message twice? That may not be what is required.

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [19 July 2024 15:49 UTC](https://discourse.nodered.org/t/i-would-like-to-inquire-about-the-dropdown-node/89559/6 "2024-07-19T15:49:19Z")

</div>

> [@joepavitt](#):
>
> In Node-RED, `msg` is a live object that doesn't exist once dealt with. In Dashboard, we go against this pattern _slightly_ by having each node have a `msg` store so that we can revive state on refresh of a dashboard, but having this pattern of using the button as a temporary store is not something I could advocate

This is what the dropdown does it store incoming msg options for dynamic content, I fail to see why we can not have dynamic button/switch payloads. I for one would see it as a benefit.

Why would you need to store in context when the value is in the msg and storing is not really required? and may result in race conditions.

> [@Colin](#):
>
> I would say doing it that way is a bit of an anti-pattern. I think that ideally the UI should be kept distinct from the logic,

A dynamic payloads is not really logic it is giving the possibility of changing the payload dynamically using the incoming msg properties, as the dropdown can do, as well as dynamic content for form or text nodes etc.

This could also be done with a ui form when it is fixed, and prefilling the form does not pass on the payload without a submit.

---

<div class="post-metadata">

### Author: ![joepavitt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/joepavitt/32/59722_2.png) [@joepavitt](https://discourse.nodered.org/u/joepavitt)
#### Post date: [19 July 2024 16:03 UTC](https://discourse.nodered.org/t/i-would-like-to-inquire-about-the-dropdown-node/89559/7 "2024-07-19T16:03:00Z")

</div>

> [@E1cid](#):
>
> This is what the dropdown does it store incoming msg options for dynamic content, I fail to see why we can not have dynamic button/switch payloads. I for one would see it as a benefit.

There is a difference with overriding a configuration (how we do via `msg.ui_update.<property>`) and using `msg.payload` here, which is the vast majority of cases represents a _value_ of a widget, which is normally a passing thing.

> [@E1cid](#):
>
> Why would you need to store in context when the value is in the msg and storing is not really required? and may result in race conditions.

The race condition is equally applicable in the button as it is in the store?

> [@E1cid](#):
>
> This could also be done with a ui form when it is fixed, and prefilling the form does not pass on the payload without a submit.

The [Pull Request](https://github.com/FlowFuse/node-red-dashboard/pull/1092) is open - and _mostly_ works, I submitted a review this afternoon, and am just waiting on one final piece to get fixed.

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [19 July 2024 16:21 UTC](https://discourse.nodered.org/t/i-would-like-to-inquire-about-the-dropdown-node/89559/8 "2024-07-19T16:21:10Z")

</div>

> [@joepavitt](#):
>
> There is a difference with overriding a configuration (how we do via `msg.ui_update.<property>`) and using `msg.payload` here, which is the vast majority of cases represents a _value_ of a widget, which is normally a passing thing.

Then allow button payload to be overridden by an msg .ui\_update property, not necessarily msg.payload. I know it is possible now using msg.topic, but the topic may already be i use in the flows logic already.

> [@joepavitt](#):
>
> The race condition is equally applicable in the button as it is in the store?

You are probably correct, but I still do not see the reason to store in context, when the value is available in the msg properties., and there is no reason to store it.

---

<div class="post-metadata">

### Author: ![Athurian](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@Athurian](https://discourse.nodered.org/u/Athurian)
#### Post date: [22 July 2024 03:11 UTC](https://discourse.nodered.org/t/i-would-like-to-inquire-about-the-dropdown-node/89559/9 "2024-07-22T03:11:43Z")

</div>

It is possible to do it this way. Thank you so much for your reply.

---

<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: [5 August 2024 03:12 UTC](https://discourse.nodered.org/t/i-would-like-to-inquire-about-the-dropdown-node/89559/10 "2024-08-05T03:12:42Z")

</div>

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