# SelectRequestOptions addon - display as dropdown select

**URL:** <https://discourse.getcockpit.com/t/selectrequestoptions-addon-display-as-dropdown-select/1417>\
**Category:** Support\
**Created:** [May 1, 2020, 10:36pm UTC](https://discourse.getcockpit.com/t/selectrequestoptions-addon-display-as-dropdown-select/1417 "2020-05-01T22:36:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gnagnu](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/gnagnu/32/572_2.png) [@gnagnu](https://discourse.getcockpit.com/u/gnagnu)\
**Post date:** [May 1, 2020, 10:36pm UTC](https://discourse.getcockpit.com/t/selectrequestoptions-addon-display-as-dropdown-select/1417/1 "2020-05-01T22:36:01Z")

</div>

Hi @raffaelj,

I’ve installed the SelectRequestOptions addon which is really great for my usecase.

I wonder how I could modify it to display the field as a dropdown select (html ) rather than radio buttons?

Thank you!

Hang

---

<div class="post-metadata">

**Author:** ![raffaelj](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/raffaelj/32/331_2.png) [@raffaelj](https://discourse.getcockpit.com/u/raffaelj)\
**Post date:** [May 2, 2020, 1:56pm UTC](https://discourse.getcockpit.com/t/selectrequestoptions-addon-display-as-dropdown-select/1417/2 "2020-05-02T13:56:59Z")

</div>

The dropdown select is not implemented yet, but it should be easy to add it here:

> <https://github.com/raffaelj/cockpit_SelectRequestOptions/blob/master/assets/components/field-select-request-options.tag#L35>

Something like:

```auto
<cp-field type="select" if="{ opts.display_field == 'select' }" opts="{ {options:values} }" bind="{ opts.bind }"></cp-field>

```

Not tested, yet.

---

<div class="post-metadata">

**Author:** ![gnagnu](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/gnagnu/32/572_2.png) [@gnagnu](https://discourse.getcockpit.com/u/gnagnu)\
**Post date:** [May 4, 2020, 9:20pm UTC](https://discourse.getcockpit.com/t/selectrequestoptions-addon-display-as-dropdown-select/1417/3 "2020-05-04T21:20:04Z")

</div>

Thanks @raffaelj !!

It works like a charm.

To support `<option>` labels I further added this:

```
                if (opts.display_field) {
                    if (opts.display_field == "select") {
                        $this.values = $this.options.map(function(o) {
                            return { value: o.value, label: o.label };
                        });
                    } else {
                        $this.values = $this.options.map(function(o) {
                            return o.value;
                        });
                    }
                }

```

[here](https://github.com/raffaelj/cockpit_SelectRequestOptions/blob/e02e35ae82876abce0a984b69a3a21b0fd2c089d/assets/components/field-select-request-options.tag#L107)

---

<div class="post-metadata">

**Author:** ![raffaelj](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/raffaelj/32/331_2.png) [@raffaelj](https://discourse.getcockpit.com/u/raffaelj)\
**Post date:** [May 6, 2020, 12:57am UTC](https://discourse.getcockpit.com/t/selectrequestoptions-addon-display-as-dropdown-select/1417/4 "2020-05-06T00:57:30Z")

</div>

I’m glad, that it worked. I opened an [issue](https://github.com/raffaelj/cockpit_SelectRequestOptions/issues/2) as a reminder to add a dropdown select soon…
