Webgirl32
10-22-2004, 01:36 PM
Okay i am having some trouble with an on Change Event. I have a drop down that selects a subdivsion. Once that subdivsion is seleted I want it to insert that Subdivision into a test box and in a second textbox insert the value assocaited with that sub division. Can Anyone help??? The OnChange works but once you select a different subdivision it changes both of them to the Subdivision ID instead of one being the Subdivision and the other the Subdivision ID
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../../Connections/connHopkins.asp" -->
<%
Dim rsNew
Dim rsNew_numRows
Set rsNew = Server.CreateObject("ADODB.Recordset")
rsNew.ActiveConnection = MM_connHopkins_STRING
rsNew.Source = "SELECT * FROM hopkins.tblSubdivision"
rsNew.CursorType = 0
rsNew.CursorLocation = 2
rsNew.LockType = 1
rsNew.Open()
rsNew_numRows = 0
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form>
<select name="sections" onChange="document.forms[0].hiddenfield.value = this.value; document.forms[0].hiddenfield2.value = this.value;">
<%
While (NOT rsNew.EOF)
%>
<option value="<%=(rsNew.Fields.Item("SubdivisionID").Value)%>"><%=(rsNew.Fields.Item("SubdivisionID").Value)%></option>
<%
rsNew.MoveNext()
Wend
If (rsNew.CursorType > 0) Then
rsNew.MoveFirst
Else
rsNew.Requery
End If
%>
</select>
<input type="text" name="hiddenfield" size="20" value="<%=(rsNew.Fields.Item("strSubdivision").Value)%>">
<input type="text" name="hiddenfield2" size="20" value="<%=(rsNew.Fields.Item("SubdivisionID").Value)%>">
</form>
</body>
</html>
<%
rsNew.Close()
Set rsNew = Nothing
%>
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../../Connections/connHopkins.asp" -->
<%
Dim rsNew
Dim rsNew_numRows
Set rsNew = Server.CreateObject("ADODB.Recordset")
rsNew.ActiveConnection = MM_connHopkins_STRING
rsNew.Source = "SELECT * FROM hopkins.tblSubdivision"
rsNew.CursorType = 0
rsNew.CursorLocation = 2
rsNew.LockType = 1
rsNew.Open()
rsNew_numRows = 0
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form>
<select name="sections" onChange="document.forms[0].hiddenfield.value = this.value; document.forms[0].hiddenfield2.value = this.value;">
<%
While (NOT rsNew.EOF)
%>
<option value="<%=(rsNew.Fields.Item("SubdivisionID").Value)%>"><%=(rsNew.Fields.Item("SubdivisionID").Value)%></option>
<%
rsNew.MoveNext()
Wend
If (rsNew.CursorType > 0) Then
rsNew.MoveFirst
Else
rsNew.Requery
End If
%>
</select>
<input type="text" name="hiddenfield" size="20" value="<%=(rsNew.Fields.Item("strSubdivision").Value)%>">
<input type="text" name="hiddenfield2" size="20" value="<%=(rsNew.Fields.Item("SubdivisionID").Value)%>">
</form>
</body>
</html>
<%
rsNew.Close()
Set rsNew = Nothing
%>