Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic menu highlight with an array

Status
Not open for further replies.
Aug 1, 2003
85
US
I've tried several ways to make this work but no luck so far. Recordset2 has currently 3 names in it. Recordset1 is the resolved_by field populated by the menu.
Here is the code

<td width="133" valign="top" class="adstat2"><select name="Resolved_by" size="4" multiple="multiple" id="Resolved_by">

<%
Dim MYArray1
Dim MYArrayLength1, i1
Dim MYArray2
Dim MYArrayLength2, i2
Dim highlight

MyArray2 = Split(Recordset2("Username"), ",")
MYArrayLength2 = UBound(MYArray2)
MyArray1 = Split(Recordset1("Resolved_by"), ",")
MYArrayLength1 = UBound(MYArray1)
For i2 = 0 to MYArrayLength2
MyString2 = MyArray2(i2)
For i1 = 0 to MYArrayLength1
MyString1 = MyArray1(i1)
%>
<%
If (Not isNull(MyString1)) Then If (MyString2 = MyString1) Then highlight="SELECTED" else highlight=""
%>
<%
Response.Write("<option value=" & "'" & MyString2 & "'" & highlight & ">" & MyString2 & "</option>" & vbCr)
Next
Next
%>
</select>
</td>

Problem is I get only the first name (it is highlighted however). I think it's cause of not having a while wend code. Ive tried other scripts that had the while wend incorporated and I could only get the first name highlighted but the menu was populating all the names.
I'm trying to get a menu dynamically populated from a recordset and have those values that match the values in the array highlighted.


Thanks,
Dan

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top