Could someone helpme with the ASP and Javascript please.

M

MrHelpMe

I have been directed here.

Hello all,

I have tried other forums and they have been nice enough to help until
a point. I have the following code below and it is doing the
following. Next to an input box I will have something saying choose
from list.(This is working on Test.asp page). When I click on the
text, a popup box opens and there are 2 fields. Once called Partial
Search where a user can start typing his search info. and a
dropdownlist (I don't care what element is used). What it should do
is when the user starts typing a partial search the element below (in
this case the dropdownlist) should start to move or highlight all the
values that equal the partial search (like a lookup table). <b>THIS IS
NOT WORKING</b>. The dropdownlist is querying active directory
(working perfectly) with too many values so this is why I need the
partial search. Then when I click Select (After I found the value I
was looking for), the input box(next to the Choose from list Text)
should be populated with the result of the search term<b>(Also not
working)</b>. Let me know if that makes sense. Thanks.


Test.asp
Code:
<%@ Language="VBScript" %>
<%OPTION EXPLICIT%>
<%
'Declare variables
Dim objConnection
Dim objCommand
Dim objRecordSet
%>
<HTML>
<HEAD>
<TITLE>test</TITLE>
<script type="text/javascript">
function popup(mylink, windowname){
href=mylink.href;
window.open(href, windowname,
'width=360,height=260,scrollbars=no,top=200,left=1    95');
return false;
}
</script>
</HEAD>

<TABLE height="0" width="100%" bgcolor="336699" border="0"
cellspacing="0" cellpadding = "0" align="center">
<FORM name="form1" action="" method="post">
<TR>
<TD align="Center"><FONT color="#FF0000">* </FONT><font size = "2"
color = "Black"><B> Required Information</B></font></TD>
</TR>
</TABLE>
<BR>
<TABLE border="1" cellspacing="0" align="center" bgcolor="336699">
<TR>
<TD><DIV align="left"><font color="#FF0000">* </font><FONT
color="White"><B>Name:</B></FONT></TD>
<TD><input type="text" name="username"> <A HREF="test1.asp"
onClick="return popup(this, 'UserPicker');"><font
color="white">Choose
from List</font></A></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="button" name="Send"
value="Submit">
</td>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>


This is the recieving page test1.asp


Code:
<html>
<head>
<TITLE>User List</TITLE>
<script type="text/javascript">
<!--
function dosearch(){
document.pickform.action="hgfgf";
document.pickform.criteria=document.partial.value;
document.pickform.submit();
}


//-->

</script>
</head>
<body>
<%
If Request.Form("action") <> "add_user" Then
%>
<TABLE height="0" width="100%" bgcolor="336699" border="0"
cellspacing="0" cellpadding = "0" align="center">
<form name="pickform" action="test1.asp" method="post">
<table border="0">
<tr><td colspan="2"><b>Select User From list:</b></td></tr>
<tr><td colspan="2"> </td></tr>
<tr><td colspan="2"> </td></tr>
<tr><td>Partial Search </td><td><input type="text" name="partial"
onchange="dosearch()"></tr>
<tr><td><input type="hidden" name="criteria"></td></tr>
<tr><td colspan="2">
<input type="hidden" name="action" value="add_user" />
<%Dim testvar%>
<%testvar= request.form("partial")%>
<%
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand =   CreateObject("ADODB.Command")


objConnection.Provider = "ADsDSOObject"
objConnection.Properties("User ID") = "Hidden"
objConnection.Properties("Password") = "Hidden"


objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection


objCommand.Properties("Page Size") = 10000
objCommand.Properties("Timeout") = 50
objCommand.Properties("Cache Results") = False


objCommand.CommandText = _


"SELECT Name FROM 'LDAPserver' where Field1 = 3 and field2 <> 111
ORDER BY NAME"


If Request.Form("criteria") <> "" Then objCommand.CommandText = _
"SELECT Name FROM 'LDAPserver' where Field1 = 3 and field2 <> 111 and
name like ='" & TestVar & "'"


Set objRecordSet = objCommand.Execute
%>
<select size="1" name="D1">
<option selected value="ZZZZZZ">Please Select</option>
<%
If ((objRecordSet.BOF <> True) And (objRecordSet.EOF <> True)) Then
'Loop through all of the records that have been found
While Not objRecordSet.EOF%>
<option value="<%=Trim(objRecordSet("Name"))%>"><
%=Trim(objRecordSet("Name"))%></option><%
objRecordSet.movenext
Wend
End If
%>
</select>
</td></tr>
<%
'objRecordSet.Close
'oConn.Close
%>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Select">
<input type="button" value="Close" onclick="window.close()">
</td>
</tr>
</table>
</form>
<%
Else
If Trim(Request.Form("D1")) = "ZZZZZZ" Then
response.write "<script language='javascript'>window.close();</
script>"
Else
response.write"<script
language='javascript'>window.opener.document.form1.username.value="""
& Trim(Request.Form("D1")) = "ZZZZZZ" & """</script>"
response.write "<script language='javascript'>window.close();</
script>"
End If
End If
%>
</TABLE>
</FORM>
</BODY>
</HTML>
 
E

Evertjan.

MrHelpMe wrote on 18 feb 2008 in comp.lang.javascript:
I have been directed here.

You were told Sun, 17 Feb 2008 18:40:03 +0000
in microsoft.public.inetserver.asp.general
what was wong in the first file,
like parts of asp that did not have any sense.

First correct your code with the advice given,
and then come back, please.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top