Setting value in Select component

I want to set the value of a Select or MultiSelect. In various event handlers I have tried setting the value but it never seems to stick yet no error message and nothing shows up in the UI.

Specifically I was using the Modal SHOW event for a form on an add/edit modal. In the event I was running JS to set the value like so:
1-multiSel1.value = ["asd"]
2-multiSel1.SetValue(["asd"])

Also trying with a Select component and getting same result.
Even trying in the debug console it takes the value but seems to clear it immediately.
image

1 Like

Hi @swaggerutah and welcome to the forum!

so setValue should be without the first "s" being capitalized, e.g. multiSel1.setValue(["asd"]. Also, make sure the values check with whatever values have been given to the options in your multiselect component

Thanks, so the problem is that the value I am assigning is not in the allowed options?
What I am really trying to accomplish is an autocomplete box, after at least 3 chars entered, calling the google GCP people API to lookup our organizational users. So I have the call to the API in a query as the datasource for the select component but I don't know how to make it autocomplete.

Hey @swaggerutah,

Ok I see what you mean.

Does your directory contain thousands of records and that's why you don't want to load it on page load? If you could have all those records available and simply map your options in yoru select component with the results of the query, then the user could type into the select component and search from within all of your directory.

Unfortunately retool lacks a component like the classic search bars where you'd see options below as you type.

1 Like

Yes, far too many results (users) to fetch all users on page load.

I was able to finagle it into mostly working but I had to trick the system a bit with some event script for special handling.

Thanks for your suggestions

1 Like