Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Could someone help with my ASP code below

Reply
Thread Tools

Could someone help with my ASP code below

 
 
MrHelpMe
Guest
Posts: n/a
 
      02-17-2008
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">
<!--
var originalvariable

function popup(mylink, windowname){
href=mylink.href;
window.open(href, windowname,
'width=360,height=260,scrollbars=no,top=200,left=1    95');
return false;
}

document.form1.target = name;
document.form1.action = "ProcessSubmit.asp";
document.form1.submit();
}
//-->
</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">&nbsp;<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">&nbsp;</td></tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr><td>Partial Search&nbsp;</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">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Select">&nbsp;
<input type="button" value="Close" onclick="window.close()">&nbsp;
</td>
</tr>
</table>
</form>
<%
Else
If strSelection = "ZZZZZZ" Then
response.write "<script language='javascript'>window.close();</
script>"
Else
response.write"<script
language='javascript'>window.opener.document.form1.username.value="""
& strSelection & """</script>"
response.write "<script language='javascript'>window.close();</
script>"
End If
End If
%>
</TABLE>
</FORM>
</BODY>
</HTML>
 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      02-17-2008
MrHelpMe wrote on 17 feb 2008 in microsoft.public.inetserver.asp.general:

> Test.asp


The rest of this page does not contain any ASP,
do why declare the below thayt is not used?

===================================
> <%@ Language="VBScript" %>
> <%OPTION EXPLICIT%>
> <%
> 'Declare variables
> Dim objConnection
> Dim objCommand
> Dim objRecordSet
>
> %>

=========================

> <HTML>
> <HEAD>
> <TITLE>test</TITLE>
>
> <script type="text/javascript">
> <!--


last century coding to use this: <!--
leave it out!

> var originalvariable


This clientside variable is not used.

>
> function popup(mylink, windowname){
> href=mylink.href;
> window.open(href, windowname,
> 'width=360,height=260,scrollbars=no,top=200,left=1 95');
> return false;
>}


The below code does not belong to anything, so will give an error,
please report all errors with errortext and linenumber.

==========================
> document.form1.target = name;
> document.form1.action = "ProcessSubmit.asp";
> document.form1.submit();
>}

==========================

> //-->


See above.

> </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>


Why use a table here?
Why not use css?
Why starting a <form> in the middle of a table where it is not used yet?

> <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">&nbsp;
> <A HREF="test1.asp" onClick="return popup(this, 'UserPicker');">
> <font color="white">Choose > from List</font></A></td>


Why use a anchor here, if you only use the onclick??
All those antique <font> declarations are a terrible sight,
use css styles!

> </tr>
> <tr>
> <td colspan="2" align="center">
> <input type="button" name="Send" value="Submit">
> </td>
> </TR>
> </TABLE>
> </FORM>
> </BODY>
> </HTML>


Seems to me you have a lot of work to do on this file,
before even touching the next one.

As most of it is not ASP related, please ask in a clientside NG.


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
 
Reply With Quote
 
 
 
 
s_m_b
Guest
Posts: n/a
 
      02-22-2008
MrHelpMe <(E-Mail Removed)> wrote in news:f4a1ab76-4944-4c1b-b3ff-
http://www.velocityreviews.com/forums/(E-Mail Removed):

Why not do this via Ajax? Most of what you're trying to do is client side
anyway.


> 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">
> <!--
> var originalvariable
>
> function popup(mylink, windowname){
> href=mylink.href;
> window.open(href, windowname,
> 'width=360,height=260,scrollbars=no,top=200,left=1    95');
> return false;
> }
>
> document.form1.target = name;
> document.form1.action = "ProcessSubmit.asp";
> document.form1.submit();
> }
> //-->
> </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">&nbsp;<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">&nbsp;</td></tr>
> <tr><td colspan="2">&nbsp;</td></tr>
> <tr><td>Partial Search&nbsp;</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">&nbsp;</td>
> </tr>
> <tr>
> <td colspan="2"><input type="submit" value="Select">&nbsp;
> <input type="button" value="Close" onclick="window.close()">&nbsp;
> </td>
> </tr>
> </table>
> </form>
> <%
> Else
> If strSelection = "ZZZZZZ" Then
> response.write "<script language='javascript'>window.close();</
> script>"
> Else
> response.write"<script
> language='javascript'>window.opener.document.form1.username.value="""
> & strSelection & """</script>"
> response.write "<script language='javascript'>window.close();</
> script>"
> End If
> End If
> %>
> </TABLE>
> </FORM>
> </BODY>
> </HTML>
>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Browser crashes with below code.What is wrong in below code. kiran Javascript 12 12-07-2011 02:38 PM
Could someone help me with this source code? Caduceus Perl Misc 5 01-23-2007 03:24 AM
Could someone scan me a picture of the below? (Read Below) starlightvoyager@yahoo.com DVD Video 1 08-28-2006 05:42 AM
Could Someone Help me on this CODE.... THANKS!! 1111111111 C++ 11 07-12-2004 01:03 AM
how would someone I know make a good report out of the text below? joe Computer Support 15 10-17-2003 01:23 AM



Advertisments