Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
So confused this can't be hard If/Else "Object Required"
Old 06-06-2007, 11:27 AM So confused this can't be hard If/Else "Object Required"
Average Talker

Posts: 25
Name: John
Trades: 0
Hi Experts,
I hate it when I can't figure things out. Below is the asp code that is giving me an object required error message.
The if/else/end if was something I just added so if I remove it my page does not give me an error. If I add it I get an error in Line 62
Line 62 is <!-- ( as I am calling a javascript function). Any ideas. I have researched the error with no success. Thanks

Last edited by HelpR; 06-15-2007 at 02:39 PM.. Reason: Company Security Violation
HelpR is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-06-2007, 03:34 PM Re: So confused this can't be hard If/Else "Object Required"
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
no idea,

do we get to see line 62 in situ (and a few lines above it)
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-06-2007, 09:08 PM Re: So confused this can't be hard If/Else "Object Required"
Average Talker

Posts: 25
Name: John
Trades: 0
Chrishirst thanks for the response. Here is the rest

I don't think the error us pointing to the correct line just because I see nothing wrong with <!-------

Last edited by HelpR; 06-15-2007 at 02:40 PM.. Reason: Company Security Violation
HelpR is offline
Reply With Quote
View Public Profile
 
Old 06-07-2007, 11:33 AM Re: So confused this can't be hard If/Else "Object Required"
VTWebProperties's Avatar
Skilled Talker

Latest Blog Post:
WEB 2.0 Apps For iPhone
Posts: 64
Name: Ed
Location: Vermont
Trades: 0
By way of debugging can you check the value of objRsUser("field") and dump it to the screen? It may be you have not declared or instantiated this object- perhaps an error in the code where you are supposed to be assigning this. Also when the error is reported at line 62 try viewing the source from the browser instead of the development environment.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
VTWebProperties is offline
Reply With Quote
View Public Profile Visit VTWebProperties's homepage!
 
Old 06-08-2007, 06:39 PM Re: So confused this can't be hard If/Else "Object Required"
Average Talker

Posts: 25
Name: John
Trades: 0
VTWebProperties. Thanks for the help. Well I did what you asked response.write objRsUser("field") and got testing for the value. When I look at the source code in the browser, once again it looks like the error is telling lies. The error points to a blank line. There is nothing there that it points to that makes sense. Any other ideas? Hopefully I did what you asked.
HelpR is offline
Reply With Quote
View Public Profile
 
Old 06-08-2007, 06:54 PM Re: So confused this can't be hard If/Else "Object Required"
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
show us all the code for the page,
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-08-2007, 06:58 PM Re: So confused this can't be hard If/Else "Object Required"
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Just a thought

this is a VbScript error (0x800a01a8) and not a javascript one ?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-08-2007, 07:59 PM Re: So confused this can't be hard If/Else "Object Required"
Average Talker

Posts: 25
Name: John
Trades: 0
O.k here is all the code for the page.

Last edited by HelpR; 06-15-2007 at 02:40 PM.. Reason: Company Security Violation
HelpR is offline
Reply With Quote
View Public Profile
 
Old 06-09-2007, 06:38 AM Re: So confused this can't be hard If/Else "Object Required"
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
it seems we are missing some information here,

1: the error could be coming from code in one of the includes.

2: It is a javascript error NOT an VbScript error (post #7)

do we get a url to see the error message ?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-09-2007, 12:07 PM Re: So confused this can't be hard If/Else "Object Required"
Average Talker

Posts: 25
Name: John
Trades: 0
Hi ChristH,

O.k I cannot provide a URL because the app is not published yet. It is still running from my localhost. I know the issues are not from the abovbs.inc, nor the db_connection.asp. I think it could be from this. Also, I thought post Number 7 said
"this is a VbScript error (0x800a01a8) and not a javascript one ?" and not vice versa like you suggestion. Regardless, could it be this one. I don;t have any javacript except what is provided with the function show(menuName), function hide(menuName), function toggle_visibility(id), function checkParam(). Let me know if you need anything else.

Last edited by HelpR; 06-15-2007 at 02:41 PM.. Reason: Company Security Violation
HelpR is offline
Reply With Quote
View Public Profile
 
Old 06-09-2007, 12:29 PM Re: So confused this can't be hard If/Else "Object Required"
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
That has to be a VBScript error. There's no way a Javascript error would spit out a hex code like that. That's VBScript.

HelpR, what it looks like to me is that you're trying to close a connection object that you've created inside of a function (likely in your db_connection.asp include file). If that's the case, try creating your connection object without using a function (use a sub instead to create it, then create a second one to close it).
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 06-09-2007, 02:45 PM Re: So confused this can't be hard If/Else "Object Required"
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,023
Name: Forrest Croce
Location: Seattle, WA
Trades: 0
It sounds like a VBScript error to me, from the hex code and the "object required" message. That's a condition that can happen in just about any modern programming language, but the .net version is "Object reference not set to an instance of an object" ... and maybe it's just me having seen that too many times from aspx pages that I come to associate it with Microsoft tech. And yeah, I know, Microsoft wrote the implementation of JS in IE, but still...

Expanding on what Adam said, you probably want a sub or function to open your database connection, and a second one to close it. The latter would read like:

Sub CloseDatabaseConnection()
If dbConn Is Not Nothing Then
dbConn.Close()
dbConn = Nothing
End If
End Sub

Setting the reference to nothing frees up some resources on the server(s) while testing it before using it prevents this error ... if this is where it's coming from.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 06-09-2007, 07:21 PM Re: So confused this can't be hard If/Else "Object Required"
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
What is the full error message you are getting shown in your browser?


BTW I was asking if the error code was (0x800a01a8)
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-10-2007, 06:12 PM Re: So confused this can't be hard If/Else "Object Required"
Average Talker

Posts: 25
Name: John
Trades: 0
Wow thanks for the responses guys. O.k first response with respect to closing a connection in my db_connection file. No this is not the case. I feel like I am going to be adding the code for the whole app here but that's o.k.
o.k this is the db connection file.
Thanks again everyone.

Last edited by HelpR; 06-15-2007 at 02:41 PM.. Reason: Company Security Violation
HelpR is offline
Reply With Quote
View Public Profile
 
Old 06-10-2007, 07:18 PM Re: So confused this can't be hard If/Else "Object Required"
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
As suspected that is a client side javascript error NOT a ASP VbScript error

What it is telling you is that you are calling a javascript function that does not exist.

Use firefox and install the javascript debugging console it will tell you far more than the crap "debugging tools" in IE

it looks like the error is actually this
Code:
 if(e.style.display == 'none')
 e.style.display = 'block';
 else
 e.style.display = 'none';
 }
Which should be
Code:
 if(e.style.display == 'none') {
 e.style.display = 'block';
 } else {
 e.style.display = 'none';
} 
 }
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-12-2007, 01:28 PM Re: So confused this can't be hard If/Else "Object Required"
Average Talker

Posts: 25
Name: John
Trades: 0
ChristHirst,

**** I actually thought you had it. Sorry for the delay but I had another error in this app that was not allowing me to test your fix. I just finished correcting the first error and now I tried yours. Trying your fix still produced the same error but I think your leading in the right direction. Why I say this is expanding upon you saying it is a javascript error I removed all of the following:

As well as the green in the body section. I save my app and run it again and it works. So definitely something is wrong with this javascript that I cannot see. Can you see anything? Thanks again for all your hard work.
Note:
Just to explain what I am doing here in the javascript is if the user select's 2(Declined) for my Approval select element in the form, another textarea box will open up where by the user will need to give a decline reason. If he/she selects 1(approved) then the decline textarea remains hidden.

Last edited by HelpR; 06-15-2007 at 02:42 PM.. Reason: Company Security Violation
HelpR is offline
Reply With Quote
View Public Profile
 
Old 06-12-2007, 08:10 PM Re: So confused this can't be hard If/Else "Object Required"
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
in the body onLoad event
Code:
<body ... onLoad="hide('textarea');">
You pass the elements name attribute to the function, then try to use it with getElementById()
Code:
function hide(menuName) {
 var el = document.getElementById(menuName);
 el.style.display = 'none';
 }
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-12-2007, 09:02 PM Re: So confused this can't be hard If/Else "Object Required"
Average Talker

Posts: 25
Name: John
Trades: 0
Sorry Chrishirst,

You lost me on that one. Could you explain that again pleazze?
HelpR is offline
Reply With Quote
View Public Profile
 
Old 06-12-2007, 09:14 PM Re: So confused this can't be hard If/Else "Object Required"
VTWebProperties's Avatar
Skilled Talker

Latest Blog Post:
WEB 2.0 Apps For iPhone
Posts: 64
Name: Ed
Location: Vermont
Trades: 0
Quote:
Originally Posted by chrishirst View Post
in the body onLoad event
Code:
<body ... onLoad="hide('textarea');">
You pass the elements name attribute to the function, then try to use it with getElementById()
Code:
function hide(menuName) {
 var el = document.getElementById(menuName);
 el.style.display = 'none';
 }

What he is saying here is on the onLoad event of the document you are firing off the function named "hide" and passing it the value 'textarea' which is not an element ID as expected by the function but rather an element TYPE. If you are in fact using the phrase 'textarea' as an ID for a field you ought to change it [even to something like 'textarea1'] so as not to confuse the browser.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
VTWebProperties is offline
Reply With Quote
View Public Profile Visit VTWebProperties's homepage!
 
Old 06-13-2007, 03:49 AM Re: So confused this can't be hard If/Else "Object Required"
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Yep that's about it, only the textarea has the name of "textarea" as well

Code:
 <td><textarea name="textarea" id="bar" cols="50" rows="8"></textarea></td>
in the select onChange event you call it correctly
Code:
<select name="Approval" onChange="toggle_visibility('bar')">
but in the body onLoad event you call the hide function
Code:
<body ... onLoad="hide('textarea');">
incorrectly

this is where the "Object Expected" is coming from, because it is looking for an element with an ID of "textarea" and coming empty handed.

It should be
Code:
<body ... onLoad="hide('bar');">
Also;

in this code
Code:
if userSession="" Or HardwareSession = "" Then
%>
<p>
 <CENTER><font color = "black"><h2><%=Response.Write ("")%></h2><h3><%=Response.Write ("I'm sorry, I could not find that record")%></h3></font></CENTER> 
</p>
You should use either the equals sign "=" OR "response.write" but not both

The "=" sign IS a shortcut for response.write in single line code blocks.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to So confused this can't be hard If/Else "Object Required"

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.30005 seconds with 12 queries