.setValue not working on Bootstrap Selects when data source is present

Wappler Version: 4.4.3
Operating System: Windows 11
Server Model: PHP
Database Type: MySQL
Hosting Type: Custom

Expected behavior

Using the set value option in a flow or in an event should set the value in a bootstrap-select/dropdown.

Actual behavior

When a select/dropdown is filled with a data source server connect this no longer works. Removing the data source makes it work as expected.

How to reproduce

  • Add a bootstrap select to the page.
  • Set the data source to a server connect
  • Create a button with a click event that sets the value of the select. It will not set the value.
1 Like

Are you sure the value you are trying to set exists as a value for any of the options in the select?

It does, yes. That was triple-checked and the select values go from 1-10, trying to set any of those still doesn’t set the value correctly. And using inspect element I can see the value in the select is correct.

What is the exact setvalue code you are using? Note that the input values are always strings, so you maybe just don’t send a string with the setvalue action.

Ah…I see, that’s the issue then - But this still seems to be a bug in that case.

Using Wapplers UI it sets assigneduser.setValue(1), if I manually change it to assigneduser.setValue('1') it’s fine, so this seems to be a UI issue

Thank you

1 Like

Not sure how can this be improved in any way. When you enter the 2 value in the UI it’s considered a number, but the inputs values are always strings. Which means 2 is not equal to '2'
Maybe @patrick can check if we can improve the
value comparison when using setvalue for elements like select menus.

1 Like

Stumbled upon this too.
Thanks to this discussion, I now understand why it happens and how to solve this.

I get the logic behind this behavior, but I have to agree with @Digo , that it would be good to have some built-in seamless solution for this.
Just to reduce the confusion for users, who don’t know about this issue.

1 Like

Fixed in Wappler 4.8.2

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