Hi,
I have a dropdown menu which when an account is selected I would like to have a textbox automatically populate with the account number.
Here is what I have started ...
<script language="javascript">
function MoveacctNumber()
{
var myVar = document.form1.acctNumber.value;
document.form1.txtID.value = myVar;
}
</script>
</head>
<body>
<form name="form1">
<select name="acctNumber" id="select" OnChange="MoveacctNumber()">
<%
While (NOT rstest.EOF)
%>
<option value="<%=(rstest.Fields.Item("acctName").Value)%>" <%If (Not isNull((rstest.Fields.Item("acctName").Value))) Then If (CStr(rstest.Fields.Item("acctName").Value) = CStr((rstest.Fields.Item("acctName").Value))) Then Response.Write("SELECTED") : Response.Write("")%> ><%=(rstest.Fields.Item("acctName").Value)%></option>
<%
rstest.MoveNext()
Wend
If (rstest.CursorType > 0) Then
rstest.MoveFirst
Else
rstest.Requery
End If
%>
</select>
<br>
<input type="text" name="txtID">
</form>
My problem is that I keep populating the textbox with the accountName instead of the corresponding acctNumber.
thanks for any help,
Jay
I have a dropdown menu which when an account is selected I would like to have a textbox automatically populate with the account number.
Here is what I have started ...
<script language="javascript">
function MoveacctNumber()
{
var myVar = document.form1.acctNumber.value;
document.form1.txtID.value = myVar;
}
</script>
</head>
<body>
<form name="form1">
<select name="acctNumber" id="select" OnChange="MoveacctNumber()">
<%
While (NOT rstest.EOF)
%>
<option value="<%=(rstest.Fields.Item("acctName").Value)%>" <%If (Not isNull((rstest.Fields.Item("acctName").Value))) Then If (CStr(rstest.Fields.Item("acctName").Value) = CStr((rstest.Fields.Item("acctName").Value))) Then Response.Write("SELECTED") : Response.Write("")%> ><%=(rstest.Fields.Item("acctName").Value)%></option>
<%
rstest.MoveNext()
Wend
If (rstest.CursorType > 0) Then
rstest.MoveFirst
Else
rstest.Requery
End If
%>
</select>
<br>
<input type="text" name="txtID">
</form>
My problem is that I keep populating the textbox with the accountName instead of the corresponding acctNumber.
thanks for any help,
Jay