Is it possible to select the default value for a dropdown directly in the widget, without using any JS or clientAction to set the variable associated with the dropdown, directly from the widget settings?
I have tried using the "Empty Text" field, but this doesn't seem to be a valid option, only an additional field displayed in the dropdown.
oml attached (ODC)
In OnAfterFetched of the aggregate GetAppointmentStatusById, you can set the default value there for the fields of your form
I open your oml, its O11, not ODC. Is it right one?
cannot open in O11, some prerequisites are not matched
In fact, I think the code generated will be in reactjs which will apply the 2-way binding method. Which means everything to interact, you must do it via the associated variable.
You can set default value of the associated variable to let the dropdown prefilled at the begining.
Hi @Shingo Lam
Thank you for the feedback.
It is an ODC app, I checked it again, just in case. Not sure why you are getting that error message?
I am also having the same error message when trying to open your OML. Will try a different version later.
if the below variable has data, the dropdown will auto select it My sample can be check here: https://personal-zfpr4idz-dev.outsystems.app/DropdownTesting/
you are right on the point, @Shingo Lam . Issue is that the variable has no data, as the form is for a new request. I wanted to pre-populate some of the fields. Looks like I have to manipulate the variable.
Appreciate your responses.
Thanks @Shingo Lam .
So, my take is that "it is not possible to set a default value for a dropdown DIRECTLY in the widget, without calling a client action"...
Since there isn't a way to do this directly in the widget settings, i believe your suggestion is a very reasonable answer.
thank you
The dropdown works the same way in all OutSystems versions. The value it has at any given time is the value in the variable.
The default value is the value in the variable before it loads.
The current value being shown is the value in the variable.
The value submitted is submitted in the variable.
The dropdown is just a tool for humans to select the value, but the information is stored in the variable.
You can and should set the value at OnInitialize, even before the list of options is loaded.