TWEBLOOKUPCOMBOBOX - Error loading the Value property.

I'm using the TWebLookUpComboBox object in my project. I load its content in a procedure where I receive the response from an API and build the pairs using JSON, and this works perfectly. My issue arises when I try, in another procedure, to change the value of this combobox so that the display is altered, but the element doesn't change at all.

I created a test case with 2 buttons and 3 boxes where:

Button 1, when clicked, loads the pairs into the first box's items and successfully sets the value to 5. Button 2, when clicked, sets the value to 1 with three different results:

  • In the first result: Box 1, where the ElementeID is linked to the HTML, is only updated using a JavaScript function to force the update.
  • In the second result: Box 2, where ElementeID is NOT linked, is updated correctly without using an extra function.
  • In the third result: Box 3, where ElementeID is linked to the HTML, is NOT updated as expected when using box3.value := '1'.

Here's the test case.

Was a sample source project supposed to be included?

Could you send me an email address please?

help@tmssoftware.com

The email has been sent

Hi Bruno, how are you? Do you have any predictions about this error?

It is on my todolist, I have been out of office past 4 days...

Alright, thank you

You have this script in your code

  $('.select2bs4').select2({
        theme: 'bootstrap4',
        placeholder: "Selecione uma opção",
    });

and this transforms the HTML SELECT elements into a combination of <UL> and <LI> elements.

When TWebLookupComboBox is linked to a HTML element, it expects a SELECT element with elements, so this JavaScript code you added breaks the linking between TWebLookupComboBox and the SELECT element in the template.

Good morning Bruno,

Do you have any suggestions to make this work?

Remove this piece of JavaScript code and leave the combobox to be a SELECT element

I am attaching an example in Visual Studio Code of using Select2 in conjunction with WebCombobox, I believe it may help others who have the same question. Thanks.
TMSWEBCORE_SELECT2.zip (851.7 KB)