Forum Moderators: phranque

Message Too Old, No Replies

Use of Selectedindex with dynamic list

User of selectedindex with dynamic list

         

bmatth1

11:13 pm on Sep 2, 2003 (gmt 0)

10+ Year Member



I am trying to reference a record in a dynamic list box. This value would then be displayed in a text field and stored into another table. Here is the code that someone on this forum gave to me. It works, but I cannot reference the recordset and obtain information from that specific record:

function passvalue(){
document.form1.select2.value=document.form1.select[document.form1.select.selectedindex].value;
}

<td> <select name="select" onchange="passvalue()">
<%
While (NOT Weekof.EOF)
%>
<option value="<%=(Weekof.Fields.Item("dweekofvalue").Value)%>"><%=(Weekof.Fields.Item("dweekofvalue").Value)%></option>
<%
Weekof.MoveNext()
Wend
If (Weekof.CursorType > 0) Then
Weekof.MoveFirst
Else
Weekof.Requery
End If
%>
</select>&nbsp;

Thank you,
Bob

garann

5:24 pm on Sep 3, 2003 (gmt 0)

10+ Year Member



A little more information might be helpful: What is the error you're getting? Is it telling you that Weekof is null, or are your options simply empty? Or do you get your error in the JavaScript?

By the way, I think you can change

<%=(Weekof.Fields.Item("dweekofvalue").Value)%>
to just
<%=Weekof("dweekofvalue")%>
If you wanted to cut down on code..