B4J Question Specular combobox or listbox on the HTML page

micro

Well-Known Member
Licensed User
Longtime User
Hi to all
I have to implement a combobox in a html page updated by a websocket in B4j.
No problem with a button, textfield, label (all JQueryElement) etc. but I can not justly implement a combobox or listbox.
This listbox has to be mirrored to a combobox present in b4j code.
If changing selection of b4j must change the selection on the html page and vice versa and when you connect with websocket (the first time) the listbox on the html page must charge with the values of the combobox in b4J.
Some examples?
Thanks.
 

micro

Well-Known Member
Licensed User
Longtime User
Thanks Erel
Ok for populate combobox on html page but load selected not work properly (duplicate item)

B4X:
Dim i As Int
Dim sb As StringBuilder
sb.Initialize
For i = 0 To Main.attivita.boxlist1.Items.Size - 1
     Dim val As String = WebUtils.EscapeHtml(Main.attivita.boxlist1.Items.Get(i))   
     sb.Append("<option value='").Append(val).Append("'>").Append(val).Append("</option>")
Next
val = WebUtils.EscapeHtml(Main.attivita.boxlist1.Items.Get(Main.attivita.boxlist1.SelectedIndex))
sb.Append("<option selected>" & val & "</option>")
jq1.SetHtml(sb.ToString)
The selected text is right but it's a duplicate item.
 
Upvote 0
Top