asked on
<!-- Save the Selected Empl ID from the dropdown -->
<script type="text/javascript">
var strSelectedID;
function showSelected(val){
strSelectedID = val;
document.getElementById
('selectedResult').innerHTML = "Empl ID = "+strSelectedID;
}
</script>
.
.
.
'-- F I L L D R O P D O W N W I T H E M P L O Y E E S -->
' Open connection string to the Sick Time Entry Online database
If not IsObject(objSickOnlineConn) then
strDataPath = server.MapPath("/hr/db/public/AbsTimeEntryOnline.mdb;")
set objSickOnlineConn = Server.CreateObject("ADODB.Connection")
strConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;"_
+ " Data Source= " & strDataPath & ";"_
+ " Mode=Share Deny None;"
objSickOnlineConn.ConnectionTimeout = 15
objSickOnlineConn.CommandTimeout = 10
objSickOnlineConn.Mode = 3 'adModeReadWrite
if objSickOnlineConn.state = 0 then
objSickOnlineConn.Open strConnectString
end if
end if
'***** T E S T I N G O N L Y ***** TEST ONLY!
strEmplID = "1000003"
sql = "SELECT DISTINCT [EmplID_(OPRDEFN)], [EE Name] AS EE_Name, [EmplID_(GROUP_DTL)] AS Selected_ID FROM tbl_EmplID_RowSecurity_xref WHERE (([EmplID_(OPRDEFN)])=" & strEmplID & ") Order by [EE Name];"
'***** D E B U G *****
' Response.Write(sql & "<br>")
set rsSelect = objSickOnlineConn.execute(sql)
%>
<form>
<select name="Name" style="font: 8pt verdana;" onChange='showSelected(this.value)'>
<option value="">Select Employee</option>
<%
While (NOT rsSelect.EOF)
%>
<option value="<%=(rsSelect.Fields.Item("Selected_ID").Value)%>" <%if (CStr(rsSelect.Fields.Item("EE_Name").Value) = CStr(rsSelect.Fields.Item("EE_Name").Value)) then Response.Write("SELECTED") : Response.Write("EE_Name")%>><%=(rsSelect.Fields.Item("EE_Name").Value)%></option>
<%
rsSelect.moveNext()
Wend
If (rsSelect.CursorType > 0) Then
rsSelect.MoveFirst
Else
rsSelect.Requery
End If
' added in to the bottom, and extra Blank Select, for those DEEP Select List, instead of scrolling to the top, the visitor can simply choose this to end the use of this area.
%>
</select>
</form>
<%
' Close connection, deinitialize from memory
rsSelect.close
set rsSelect = nothing
objSickOnlineConn.Close
set objSickOnlineConn = nothing
%>
<!-- Employee ID is displayed below -->
<div id='selectedResult'></div>
<!-- But how do I get it back to ASP? -->
<%
Response.Write("***** D E B U G S T A R T *****<br>")
Response.Write("strSelectedID: " & strSelectedID & "<br>")
Response.Write("***** D E B U G E N D *****<br>")
%>