SelectRequestOptions addon - display as dropdown select

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

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

Something like:

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

Not tested, yet.

1 Like

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

I’m glad, that it worked. I opened an issue as a reminder to add a dropdown select soon…