• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 446
  • Last Modified:

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

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
outback2112
Asked:
outback2112
  • 3
  • 2
1 Solution
 
webwomanCommented:
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
 
outback2112Author Commented:
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
 
phuctranCommented:
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
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
webwomanCommented:
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
 
outback2112Author Commented:
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
 
webwomanCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now