WebComboBox Value Setting not working

Am I missing something obvious here? I cannot update a WebComboBox in code.

  1. Add a WebComboBox to a WebPage
  2. Add a Button to the WebPage that sets a Value for the WebComboBox
  3. Run. Click the button. The WebComboBox Value doesn’t change.

<https://xojo.com/issue/61932>

Did you try to use .UpdateBrowser on the comboBox after having changed the value ?

Tried it. Didn’t work. Greg O’ has marked it as a bug.

1 Like

Good to know, thanks for sharing. The whole “update” stuff is somehow still a bit confusing to me. Sometimes it works, sometimes it doesn’t and sometimes it is a bug. I understand that it’s important to reduce the server / client traffic but somehow it is a shame that smaller logical updates are not working within a loop for instance.

Has this been fixed? I see it in Feedback as fixed but I still have the same behavior in 2020r2

Try it, but yes, it seems to be fixed in 2020R2.

It says fixed for version 2020r2, if you have problems then can create a new case with information and sample code.

OK. It seems to work if there is no selected item from menu. But if you populate the Combobox with initial values in the menu and select any of them, then try to push the button to change the text in the combobox it fails.

There is already a case reported (62939) and marked as reproducible

Dear David, I too have encountered this problem. While waiting for the XOJO programmers to solve this problem, the solution could be the use of a Javascript.
That is, inject the value into the field identified by a script:

Combobox1.ExecuteJavaScript("document.getElementById('" + Combobox1.ControlID + "_input').value='" + TextField1.Text + "';")

Of course this is only a temporary solution but I hope it will help, I’m using it in a very complex and articulate project and it seems to work well, and it will work later when they have solved the problem. Ciao from ROB

1 Like

But if you want the Combobox1 contained text back you have to extract it with a Javascript as “Combobox1.UpdateBrowser” won’t work here. So if you don’t want the previous content but the current one you need to run a javascript to extract it like the following script:

Combobox1.ExecuteJavaScript("document.getElementById('" + TextField1.ControlID + "_field').value = document.getElementById('" + Combobox1.ControlID + "_input').value;")

I hope it will be useful :blush:

3 Likes

Case id: 63736 - Setting WebComboBox.Value to a string does not work after adding Rows & Apostrophe is not working

OS: OS X 10.14.6 - Xojo: Xojo 2020r2.1

Steps:

WebCombobox1.AddRow(“first Row”)
WebCombobox1.AddRow(“second Row”)
WebCombobox1.AddRow(“Mario’s third Row”)
WebCombobox1.AddRow(“Steven’s forth Row”)
WebCombobox1.AddRow(“Mary’s fifth Row”)

WebCombobox1.Text = “second Row"

Expected Result:
In WebCombobox1 “second Row” String visible

Actual Result:
“firts Row” String visible

Workarounds:
If you select the third Row you well see: “Mario’s third Row”

see WebCombobox1_test.xojo_binary_project Attached to Case id: 63736