# Dashboard dropdown - Allow object in msg.payload

**URL:** <https://discourse.nodered.org/t/dashboard-dropdown-allow-object-in-msg-payload/19171>\
**Category:** Feature Requests\
**Created:** [15 December 2019 06:37 UTC](https://discourse.nodered.org/t/dashboard-dropdown-allow-object-in-msg-payload/19171 "2019-12-15T06:37:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [15 December 2019 06:37 UTC](https://discourse.nodered.org/t/dashboard-dropdown-allow-object-in-msg-payload/19171/1 "2019-12-15T06:37:11Z")

</div>

Hi folks,

To be able to finish another [discussion](https://discourse.nodered.org/t/announce-node-red-contrib-ui-media-recorder-beta-version/19130/2) I need to show a list of webcams in a dropdown on my dashboard.

The list of webcams is available as label-value pairs, so I pass pairs these to the UI dropdown node:

```auto
msg.options= [ {
    label: "USB2.0 HD UVC Webcam",
    id: "csO9c0YpAf274OuCPUA53CNE0YHlIr2yXCi+SqfBZZ8=" },
    ...
]

```

And I want to make sure that the first webcam is automatically selected in the dropdown, so I also need to pass the **id** as selected value:

```auto
msg.payload = "csO9c0YpAf274OuCPUA53CNE0YHlIr2yXCi+SqfBZZ8="

```

Which all works very well:

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

However the **status** of the dropdown node shows the id, which is not really human readable:

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

_It would be nice if the label (instead of the id) could be displayed in the node status. But that means that the `msg.payload` would also have to allow a label-value pair (beside the current option to only pass a value)!_

- When only a value is passed, that value is displayed as node status (to avoid breaking existing flows).
- When label-value pair is passed, the label is displayed as node status.

Remark: have been looking at the [code](https://github.com/node-red/node-red-dashboard/blob/master/nodes/ui_dropdown.js), but it is not really clear to me how to implement this. I assume the client (only in case it gets as input a label-value pair) also needs to send a label-value pair back to the server (as soon as another option is selected in the dropdown), so the beforeSend can show the label.

Any thoughts?

Bart

---

<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:** [15 December 2019 09:09 UTC](https://discourse.nodered.org/t/dashboard-dropdown-allow-object-in-msg-payload/19171/2 "2019-12-15T09:09:55Z")

</div>

The editor is not a dashboard.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [15 December 2019 09:12 UTC](https://discourse.nodered.org/t/dashboard-dropdown-allow-object-in-msg-payload/19171/3 "2019-12-15T09:12:25Z")

</div>

> However the **status** of the dropdown node shows the id

It shows msg.payload.

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [15 December 2019 09:23 UTC](https://discourse.nodered.org/t/dashboard-dropdown-allow-object-in-msg-payload/19171/4 "2019-12-15T09:23:06Z")

</div>

> [@bakman2](#):
>
> It shows msg.payload.

Yes that is correct, but since my msg.payload is only allowed to contain the id (and not the label) it will show the id.

Case closed ...

---

<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:** [15 December 2019 09:46 UTC](https://discourse.nodered.org/t/dashboard-dropdown-allow-object-in-msg-payload/19171/5 "2019-12-15T09:46:34Z")

</div>

hmm - but html selects have always worked that way - they have the part you can see in the list and the value they return - they don't return both parts. What gets returned (the id in this case) is up to you... so you can return the name if you want.
