I'm trying to set multiple rows or values to selected based upon a query. It seems to set the "selected" but only the last value selected actually displays as selected. Anyone know what I am doing wrong?
In the first part I take what is in the database, which is using the | to separate the values and put it into an array.
Then as I'm populating the list box I check to see if any of the values match what is in the array. If so I set the strSelected variable and build the string.
And then to actually load the list box in html the following:
_______
I love small animals, especially with a good brown gravy....
In the first part I take what is in the database, which is using the | to separate the values and put it into an array.
Code:
'put all selected equipment types in an array
dim arEquipmentSelected
arEquipmentSelected = split(rs("LEquipment"), "|")
Then as I'm populating the list box I check to see if any of the values match what is in the array. If so I set the strSelected variable and build the string.
Code:
do while not rsEquip.EOF
if strEQID = trim(rsEquip("EQID")) then
strSelected = " selected"
else
for item = 0 to ubound(arEquipmentSelected)
if arEquipmentSelected(item) = trim(rsEquip("EQDesc")) then
strSelected = " selected"
else
strSelected = ""
end if
next
end if
StrEquipList = StrEquipList & "<option value=" & chr(34) & trim(rsEquip("EQDesc")) & chr(34) & strSelected & ">" & trim(rsEquip("EQDesc")) & "</option><br>"
rsEquip.MoveNext
loop
rsEquip.Close
And then to actually load the list box in html the following:
Code:
<td>Equipment: for multiple press CTRL Key<br><select name=equip multiple style="width:300;height:70;"><%=StrEquipList%></select></td>
_______
I love small animals, especially with a good brown gravy....