Select input w/multiple values selected

Hi!

I’m trying to have a multi-select input box load with existing values selected.

I have setup a select input within a form with “Multiple” ticked and I’m populating it will all the values. I have a server connect that retrieves a sub-set array of those values, which are the “selected” options.

I’m able to get a single item selected, by using this:
dmx-bind:value="scGetCatMap.data.categoryMap[0].category"

This does not:
dmx-bind:value="scGetCatMap.data.categoryMap[].category"

Anybody know how I get all the values in the categoryMap array to show as selected?

–Ken

Still haven’t found this…how to set multiple values as selected, within a multi-select control.

Any clues?

Hello @mebeingken
How do you store these values in the database?

Hi @Teodor,

In this case, the select element has a datasource representing the entire list of possible selections with a numeric id for value and a varchar for display, however the selected values are stored in another table with just the numeric value id. I query the table to get a list of id’s.

I run a server action to run the query and output that to the client.

So these are stored as separate records which you return, and not comma separated in one db field?

Correct

Hi @Teodor,

Are you suggesting I need to make a change with how I store this in order to make it work?

Sorry i didn’t have time to look at this case yet.
Will check it asap.

I tested a few things with the multi select menu, but it appears there’s some problem with it.
Patrick is going to check this and we will fix it for the next update.

1 Like

We found the problem and fixed it. The fix will be included in the upcoming update.

After the update, you will be able to do it like this:
Select your query and use the values formatter, available under collections category. Enter the field name in the property field:

The expression then looks like:

This has been improved in Wappler 2.1.6

1 Like

This topic was automatically closed after 47 hours. New replies are no longer allowed.