P
paulmitchell507
I have the following Java script on a asp page located on my company
intranet.
<html>
<head>
<title>Example combo box</title>
<script language="javascript">
<!--
function dept_onchange(frmSelect) {
frmSelect.submit();
}
//-->
</script>
</head>
<body>
<form name="frmSelect" method="Post" action="select.asp">
<SELECT name=courses LANGUAGE=javascript onchange="return
dept_onchange(frmSelect)">
<%
Set oRs=Server.CreateObject("adodb.recordset")
strSQL = "SELECT Status_ID, Staff_ID, firstlastName FROM staff
WHERE
Status_ID=1 Or Status_ID=19 ORDER by firstlastname"
oRs.Open strSQL, conn
Do while not oRs.EOF
if Request.Form("courses") = oRs("firstlastName") then
'if this is
the selected one then display as selected
Response.Write "<OPTION VALUE = '" & oRS
("staff_ID") & "'
SELECTED>"
Response.Write oRs("firstlastName") & "</
Option>"
oRs.MoveNext
else
Response.Write "<OPTION VALUE = '" & oRs
("Staff_ID") & "'>"
Response.Write oRs("firstlastName") & "</
Option>"
oRs.MoveNext
end if
loop
Could somebody tell me if it's possible to display the selected
"firstlastname" on the page? At the moment after the user makes a
selection the page is refreshed and the default 'firstlastname' is
displayed. The staff_ID value is stored in request.form("courses")
which is then posted to another ASP page but the user has no way of
telling which 'firstlastname' they selected.
My initial thoughts were to run a SQL statement using the staff_iD
held in request.form("courses") to retrieve and display the
'firstlastname'. But I don't think that will work.
Any help would be appreciated.
Classic ASP, Access 2K DB
intranet.
<html>
<head>
<title>Example combo box</title>
<script language="javascript">
<!--
function dept_onchange(frmSelect) {
frmSelect.submit();
}
//-->
</script>
</head>
<body>
<form name="frmSelect" method="Post" action="select.asp">
<SELECT name=courses LANGUAGE=javascript onchange="return
dept_onchange(frmSelect)">
<%
Set oRs=Server.CreateObject("adodb.recordset")
strSQL = "SELECT Status_ID, Staff_ID, firstlastName FROM staff
WHERE
Status_ID=1 Or Status_ID=19 ORDER by firstlastname"
oRs.Open strSQL, conn
Do while not oRs.EOF
if Request.Form("courses") = oRs("firstlastName") then
'if this is
the selected one then display as selected
Response.Write "<OPTION VALUE = '" & oRS
("staff_ID") & "'
SELECTED>"
Response.Write oRs("firstlastName") & "</
Option>"
oRs.MoveNext
else
Response.Write "<OPTION VALUE = '" & oRs
("Staff_ID") & "'>"
Response.Write oRs("firstlastName") & "</
Option>"
oRs.MoveNext
end if
loop
Could somebody tell me if it's possible to display the selected
"firstlastname" on the page? At the moment after the user makes a
selection the page is refreshed and the default 'firstlastname' is
displayed. The staff_ID value is stored in request.form("courses")
which is then posted to another ASP page but the user has no way of
telling which 'firstlastname' they selected.
My initial thoughts were to run a SQL statement using the staff_iD
held in request.form("courses") to retrieve and display the
'firstlastname'. But I don't think that will work.
Any help would be appreciated.
Classic ASP, Access 2K DB