I have a dropdown list item on a form which gets populated from an ArrayCollection. The value selected is set depending on the value retrieved from a database for the given data being displayed.
This works fine using the following code. Finds a match in the ArrayCollection to the retried data and sets the selectedindex. Works 100% until I update some other bit of data and refresh the screen. The code still works and the selectedindex value is set correctly, but the dropdown is now blank. If I change it to a combobox its fine, but I don’t want to allow users to enter a value in the combobox.
for (i = 0; i < teamAc.length; i++)
if (teamAc[i].team_id == event.result.item.team_id_op)
teamDd.selectedIndex = i;
teamDd.selectedIndex = -1
I found my solution. I have to set requiredSelection="true"