Solved

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

Posted on 2002-05-16
6
402 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 19

Accepted Solution

by:
webwoman earned 150 total points
ID: 7014516
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
ID: 7014541
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
ID: 7014755
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 19

Expert Comment

by:webwoman
ID: 7014807
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
ID: 7015095
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
ID: 7015291
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

739 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