Solved

Error: Line 71, Char 1, Error-Object Expected, Code 0

Posted on 2002-05-16
6
395 Views
Last Modified: 2008-01-09
Hi, I have created a public tool for our website using ASP and Javascript.  It's a basic search tool to allow the user to search for an Accredited provider by state and customer service unit.  Unfortunately, I have only been able to test this in house on IE 6.0.  We have some out of house employees testing it and they are getting the following error:

Line 71, Char 1, Error-Object Expected, Code 0 and
Line 117, Char 1, Error-Invalid character, Code 0

They are all using different versions of the browser so that doesn't seem to be the problem.  Some are saying the error comes up right when the page loads and others are saying it comes up when they try and subimt the page.  (Submit occurs through a JavaScript function that completes error checking and then submits the form.)

Here is the code I have.. Any ideas?  I am out of them - this is simple straight forward code.  (FYI - I have not been able to recreate the error in house this is only occuring off site).

<%
 Response.Write "<table width=100% border=0 cellpadding=0 cellspacing=0>"
   
    Response.Write "<form action=""AlternativeSearchResults.asp"" method=""Post"" id=oowform name=oowform>"      

      Response.Write "<TR>"
      Response.Write "<TD>"
      Response.Write "Required: Select a state or Province.<BR>"
      Response.Write "<select size=8 name=""StateValue"" id=""states"" MULTIPLE><option>--Select State/Province--"
      
      SET oCmd = Server.CreateObject ("ADODB.Connection")
      oCmd.Open "DSN=oracleDB; uid=alewis; pwd=colorado"
      Set oRSState = Server.CreateObject("ADODB.Recordset")
      'Creation of drop down for state/providence
      sSQL = "SELECT * FROM isStateCodes WHERE STRCOUNTRYCODE  = 'USA' OR STRCOUNTRYCODE  = 'CAN'"
      sSQL = sSQL & " ORDER BY STRSTATENAME "
      Set oRSState = oCmd.Execute(sSQL)
      
      While Not oRS.EOF
            Response.Write "<option value=" & oRSState("STRSTATECODE") & ">"
            Response.Write oRSState.Fields("STRSTATENAME")

      oRS.MoveNext
      Wend
      
      'close object
      If oCmd.State Then
            oRSState.Close
            oCmd.Close
            Set oRSState = Nothing
            Set oCmd = Nothing
      End If
      Response.Write "</select>"
      Response.Write "</TD>"
      Response.Write "</TR>"
      
      Response.Write "<TR>"
      Response.Write "<TD colspan=2>"
      Response.Write "&nbsp;"
      Response.Write "</TD>"
      Response.Write "</TR>"
      
      SET oCmd = Server.CreateObject ("ADODB.Connection")
      oCmd.Open "DSN=oracleDB; uid=alewis; pwd=colorado"
      Set oRSCustomerUnit = Server.CreateObject("ADODB.Recordset")
      
      'Division Lookup
      sSQL = "SELECT * FROM isDivCodes"
      sSQL = sSQL & " ORDER BY STRDIVNAME "
      Set oRSCustomerUnit = oCmd.Execute(sSQL)  

      Response.Write "<TR>"
      Response.Write "<TD>"
      Response.Write " Required: Select a customer service unit.<BR>"
      Response.Write "<select name=""DivisionValue"" id=""division"" MULTIPLE><option>--Customer Service Unit--"

      While Not oRSCustomerUnit.EOF
            Response.Write "<option value=" & oRSCustomerUnit("STRDIVCODE") & ">"
            Response.Write oRSCustomerUnit.Fields("STRDIVNAME")

      oRSCustomerUnit.MoveNext
      Wend
      
      'close object
      If oCmd.State Then
            oRSCustomerUnit.Close
            oCmd.Close
            Set oRSCustomerUnit = Nothing
            Set oCmd = Nothing
      End If
      
      Response.Write "</select>"
      Response.Write "</TD>"
      Response.Write "</TR>"
      
      Response.Write "<TR>"
      Response.Write "<TD colspan=2>"
      Response.Write "&nbsp;"
      Response.Write "</TD>"
      Response.Write "</TR>"
      
      Response.Write "<TR>"
      Response.Write "<TD colspan=2>"
      'Used to append the value of of the selection box from the ifram page
      Response.Write "<INPUT TYPE=""hidden"" value="""" name=""selectedValues"">"
      Response.Write "<input type=""button"" value=Search onclick='doform()' id=1 name=1>"
      Response.Write "</form>"

      Response.Write "</TD>"
      Response.Write "</TR>"
      
      'Ending Inner Table
      Response.Write "</table>"
      'Response.Write "</CENTER>"
      
      'Response.Write "</td>"
      'Response.Write "</tr>"
      'Response.Write "</table>"
      
      
%>

<!-- #INCLUDE file=footer.inc -->

<SCRIPT LANGUAGE=Javascript> 
function doform()
{
      //check to make sure a state and division was selected by the user
      var obj = document.forms[0].states;
      var found = false;
      var oowform = document.all.oowform;
      var obj2 = document.forms[0].division;
      var found2 = false;
      
      //checking for state selection
      for(var no=1;no<obj.length;no++)
      {
        if(obj.options[no].selected) found = true;

      }
      if(!found)
      {
            alert("You must pick at least one state or providence.");
      return;
      }
      
      //checking for division selection
      for(var no=1;no<obj2.length;no++)
      {
        if(obj2.options[no].selected) found2 = true;

      }
      if(!found2)
      {
            alert("You must pick at least one CARF Customer Service Unit.");
      return;
      }
      
       //submit the form to AlternativeSearchResults.asp for processing
       document.all.oowform.submit();
 }
</SCRIPT>
0
Comment
Question by:outback2112
  • 3
  • 2
6 Comments
 
LVL 19

Accepted Solution

by:
webwoman earned 150 total points
Comment Utility
It's a javascript error, not ASP. If they're getting error messages like that, I suspect they're using Netscape and you've got IE specific javascript. Did you ask them WHAT browser/version?

Just glancing at your javascript, you've got at least one document.all -- won't be supported by anything but IE.

Fix your javascript. And test it in both IE AND Netscape.
0
 

Author Comment

by:outback2112
Comment Utility
Yes, I figured it was a Javascript error, but I couldn't locate any errors in my code.  I asked them what broswer version they were using (on the website I specified IE version 4.0 or higher).  

Here are the comments I am getting:

Using Internet Explorer 5.0
Error came when I hit submit.
Message was "error"

Microsoft Internet Explorer 5

Microsoft Internet Explorer 6.0

Internet Explorer version 5.0

I am using IE version 5

MS-IExp 5.1.5 for the mac

So, none of them are getting the error from Netscape.  

Any ideas because I am out of them.



0
 
LVL 3

Expert Comment

by:phuctran
Comment Utility
I don't know if you just copied parts of the code (not in order) or the whole file.  But try to put the <script> into <head></head> and place it before <body></body> to see if it works.
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 19

Expert Comment

by:webwoman
Comment Utility
Wait, you've got that javascript AFTER the HTML? Well, of course it's going to throw errors -- it hasn't loaded yet. You can't call things before they load. If the user doesn't do anything until after it all loads, it will be fine. But hardly anybody will, they'll start hitting things BEFORE the script loads. And they'll get errors.

Move it like phuctran said. And if you need to support Netscape, you'll need to rework it.
0
 

Author Comment

by:outback2112
Comment Utility
Webwoman -

Sorry about the confusion! I meant to delete this question once you stated it was a Javascript error!  Thanks for your suggestion - I will award this to you since it was my mistake. ;-)

0
 
LVL 19

Expert Comment

by:webwoman
Comment Utility
Actually, it should go to phuctran...that's the solution.  You can drop a line to community support, they should be able to fix it.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now