I wonder if someone can help me I have a table in a DB with two fields (Supplier & SupplierID. In my ASP page I am populating a dropdown list with names from the Supplier field, what I would like to do is automatically populate a text field with the corresponding SupplierID value, for example
Supplier SupplierID
Paul 1
Tom 2
Harry 3
Therfore if i select "Tom" in the dropdown then the value 2 will be populated in the textbox
Below is teh code I have at the moment
Regards
Olly
Supplier SupplierID
Paul 1
Tom 2
Harry 3
Therfore if i select "Tom" in the dropdown then the value 2 will be populated in the textbox
Below is teh code I have at the moment
Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/GosportNC.asp" -->
<%
Dim RSsupp
Dim RSsupp_numRows
Set RSsupp = Server.CreateObject("ADODB.Recordset")
RSsupp.ActiveConnection = MM_GosportNC_STRING
RSsupp.Source = "SELECT * FROM Supplier WHERE SupplierType = 'B' AND Supplier <> 'All' ORDER BY Supplier ASC"
RSsupp.CursorType = 0
RSsupp.CursorLocation = 2
RSsupp.LockType = 1
RSsupp.Open()
RSsupp_numRows = 0
%>
<html>
<head>
<title>NewNCboard</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<%
Dim strUKDate, MYdd, MYmm, MYyy
MYdd = DatePart("d", date())
MYmm = DatePart("m", date())
MYyy = DatePart("yyyy", date())
strUKDate = (MYdd & "/ " & MYmm & "/ " & MYyy)
%>
</head>
<body>
<form name="form1" method="post" action="">
<table width="85%" border="0" align="center" cellpadding="1" cellspacing="1" style = "border-bottom: 1px solid grey; border-left: 1px solid grey; border-top: 1px solid grey; border-right: 1px solid grey">
<tr>
<td height="27" colspan="4"> <div align="center"><font size="3" face="Verdana, Arial, Helvetica, sans-serif"><strong><u>Gosport
Board Supplier Non Conformance</u></strong></font></div></td>
</tr>
<tr>
<td width="20%"><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Supplier
:</font></div></td>
<td width="39%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<select name="cmbSupplier" id="select">
<option value=" "></option>
<%
While (NOT RSsupp.EOF)
%>
<option value="<%=(RSsupp.Fields.Item("Supplier").Value)%>"><%=(RSsupp.Fields.Item("Supplier").Value)%></option>
<%
RSsupp.MoveNext()
Wend
If (RSsupp.CursorType > 0) Then
RSsupp.MoveFirst
Else
RSsupp.Requery
End If
%>
</select>
<input name="txtID" type="text" id="txtID" size="5" maxlength="5">
</font></td>
<td width="21%"><div align="right"></div></td>
<td width="20%"><div align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
</font></div></td>
</tr>
</table>
</form>
</body>
</html>
<%
RSsupp.Close()
Set RSsupp = Nothing
%>
Regards
Olly