Code for Netscape form problem using ASP

by Danny Griffin <danny(at)tillmanallengreer.com>

 Date:  Wed, 11 Oct 2000 12:58:11 -0400
 To:  Peter Benoit <pbenoit(at)triton-network.com>
 Cc:  hwg-techniques(at)mail.hwg.org
 In-Reply-To: 
  todo: View Thread, Original
Here is the full code for 
http://www.tagdevelopment.com/update_files/search3.asp.

Again, the problem is it works in IE but not Netscape.  Any ideas?

<%@LANGUAGE="JAVASCRIPT"%> <%

var rsCompanySearch__MMColParam = "0";
if(String(Request.Form("Company")) != "undefined"){ 
rsCompanySearch__MMColParam = String(Request.Form("Company"));}

%> <%
var rsCompanySearch = Server.CreateObject("ADODB.Recordset");
rsCompanySearch.ActiveConnection = "dsn=dsNewcomer;";
rsCompanySearch.Source = "SELECT ID, Company  FROM guide  WHERE Company 
LIKE '"+ rsCompanySearch__MMColParam.replace(/'/g, "''") + "%%'  ORDER BY 
Company ASC";
rsCompanySearch.CursorType = 0;
rsCompanySearch.CursorLocation = 2;
rsCompanySearch.LockType = 3;
rsCompanySearch.Open();
var rsCompanySearch_numRows = 0;
%><%
var Repeat1__numRows = 10;
var Repeat1__index = 0;
rsCompanySearch_numRows += Repeat1__numRows;
%><% var MM_paramName = ""; %>
<%
// *** Go To Record and Move To Record: create strings for maintaining URL 
and Form parameters

// create the list of parameters which should not be maintained
var MM_removeList = "&index=";
if (MM_paramName != "") MM_removeList += "&" + MM_paramName.toLowerCase() + 
"=";
var MM_keepURL="",MM_keepForm="",MM_keepBoth="",MM_keepNone="";

// add the URL parameters to the MM_keepURL string
for (var items=new Enumerator(Request.QueryString); !items.atEnd(); 
items.moveNext()) {
   var nextItem = "&" + items.item().toLowerCase() + "=";
   if (MM_removeList.indexOf(nextItem) == -1) {
     MM_keepURL += "&" + items.item() + "=" + 
Server.URLencode(Request.QueryString(items.item()));
   }
}

// add the Form variables to the MM_keepForm string
for (var items=new Enumerator(Request.Form); !items.atEnd(); 
items.moveNext()) {
   var nextItem = "&" + items.item().toLowerCase() + "=";
   if (MM_removeList.indexOf(nextItem) == -1) {
     MM_keepForm += "&" + items.item() + "=" + 
Server.URLencode(Request.Form(items.item()));
   }
}

// create the Form + URL string and remove the intial '&' from each of the 
strings
MM_keepBoth = MM_keepURL + MM_keepForm;
if (MM_keepBoth.length > 0) MM_keepBoth = MM_keepBoth.substring(1);
if (MM_keepURL.length > 0)  MM_keepURL = MM_keepURL.substring(1);
if (MM_keepForm.length > 0) MM_keepForm = MM_keepForm.substring(1);
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.text {  font-family: Arial, Helvetica, sans-serif; font-size: .28cm; 
letter-spacing: .05em}
.headline {  font-family: Arial, Helvetica, sans-serif; font-size: 12pt; 
color: #000000}
-->
</style>
</head>
<body bgcolor="#FFFFFF" background="blue_background.gif">
<table border=0 cellpadding=0 cellspacing=0 width=200>
   <tbody>
   <tr>
     <td>
       <table border=0 cellpadding=3 cellspacing=0>
         <tbody>
         <tr bgcolor="#FFCC66">
           <td><b><font
                         color=#ffffff><small>&nbsp;&nbsp;<font 
color="#000000"><span 
class="headline">Instructions</span>&nbsp;</font>&nbsp;</small></font></b></td>
         </tr>
         </tbody>
       </table>
     </td>
   </tr>
   <tr>
     <td bgcolor=#ffffff>
       <table border=0 cellpadding=2 cellspacing=0 width=200>
         <tbody>
         <tr>
           <td bgcolor=#666666>
             <table border=0 cellpadding=13 cellspacing=0
                           width=196>
               <tbody>
               <tr bgcolor="#FFFFCC">
                 <td class="text"><font class="text">Enter your company 
name or
                   contact name in the box below and click &quot;search&quot;.
                   In the results box, click on your company name. If your 
company
                   name does not appear or if you need additional 
assistance, please
                   <a href="mailto:updates(at)chamberhelp.com"><font 
color="#ff6600"><b>contact
                   us.</b></font></a> <br>
                   <br>
                   </font>
                   <form name="fmSearch" method="post" action="">
                     <input type="text" name="Company" maxlength="100">
                     <input type="submit" name="submit" value="search">
                   </form>
                   <font class="text"> </font> </td>
               </tr>
               </tbody>
             </table>
           </td>
         </tr>
         </tbody>
       </table>
     </td>
   </tr>
   <tr>
     <td>
       <table border=0 cellpadding=0 cellspacing=0 width=200>
         <tbody>
         <tr>
           <td>
             <table border=0 cellpadding=3 cellspacing=0>
               <tbody>
               <tr bgcolor="#FFCC66">
                 <td><b><span 
class="headline">&nbsp;&nbsp;Results</span>&nbsp;&nbsp;</b></td>
               </tr>
               </tbody>
             </table>
           </td>
         </tr>
         <tr>
           <td bgcolor=#ffffff>
             <table border=0 cellpadding=2 cellspacing=0 width=200>
               <tbody>
               <tr>
                 <td bgcolor=#666666>
                   <table border=0 cellpadding=13 cellspacing=0
                               width=196>
                     <tbody>
                     <tr bgcolor="#FFFFCC">
                       <td class="text"> <%
while ((Repeat1__numRows-- != 0) && (!rsCompanySearch.EOF))
{
%>
                         <table border="0" class="text">
                           <tr>
                             <td><A HREF="fmframe.asp?<%= MM_keepBoth + 
((MM_keepBoth!="")?"&":"") + "ID=" + 
rsCompanySearch.Fields.Item("ID").Value %>" 
target="right"><%=(rsCompanySearch.Fields.Item("Company").Value)%></A></td>
                           </tr>
                         </table>
                         <%
Repeat1__index++;
rsCompanySearch.MoveNext();}
%><br>
                         <br>
                         <br>
                       </td>
                     </tr>
                     </tbody>
                   </table>
                 </td>
               </tr>
               </tbody>
             </table>
           </td>
         </tr>
         </tbody>
       </table>
     </td>
   </tr>
   <!--no sub title--></tbody>
</table>
</body>
</html>

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA