ASM wrote:
> Michael McGrew a écrit :
> > I have a Dynamic drop-down box that is populated based on a ADO query.
> > This works fine. I want to capture the users selection and assign it to
> > a variable for use in another query. I am using the onChange event to
> > try and capture the users selection but it always passes the last entry
> > in the drop-down list not what the user selects.
>
> not normal ! your code seems good.
>
> what does setMgr() ?
>
> wouldn't be your asp which create wrong values ?
> did you look at html code of displayed page ?
>
> > <select name="cur_mgr"
> > onchange="setMgr(this.options[this.selectedIndex].value);">
> > <option value=""></option>
> > <%=Manager%>
> > </select>
>
>
> --
> Stephane Moriaux et son (moins) vieux Mac déjà dépassé
> Stephane Moriaux and his (less) old Mac already out of date
The setMgr function is just simple javascript to set a variable.
function setMgr(curMgr) {
var sMgr = curMgr;
}
I get the variable but it is always the last item in the drop-down
select, it doesn't reflect the selection.
I then use this variable in another ADO query:
<%
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = ("ADsDSOObject")
objConnection.Open
Set objCommand = CreateObject("ADODB.Command")
Set objRootDSE = GetObject("LDAP://rootDSE")
strRootDSE = objRootDSE.Get("defaultNamingContext")
objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
"<LDAP://" & strRootDSE & ">;(&(objectCategory=User)" & _
"(CN=" & sMgr & "));department;subtree"
Set objRecordSet = objCommand.Execute
Do Until objRecordSet.EOF
strDept = objRecordset.Fields("sAMAccountName").Value
Department = Department & "<option value='" & strDept & "'>" &
strDept & "</option>"
objRecordSet.MoveNext
Loop
%>
|