Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / JavaScript / October 2007



Tip: Looking for answers? Try searching our database.

'undefined' is null or not an object javascript

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
redog6@hotmail.com - 24 Oct 2007 22:23 GMT
Hello
I have the above javascript error on filling in mandatory fields and
submitting the form below:

http://www.wildwoodbushcraft.com/voucherformtest.htm?course_name=Bushcraft+Weeke
nd+course&price_code=SWC


This error only occurs in IE not firefox and I can't see anything
wrong with the functioning of the form.

I have been tearing my hair out on this one and would be very
gratefulf for any help.
All the best
Redge
P.S. Please reply to this group rather than by email - thanks.
Thomas 'PointedEars' Lahn - 24 Oct 2007 22:37 GMT
> I have the above javascript error on filling in mandatory fields and
> submitting the form below:
>
> http://www.wildwoodbushcraft.com/voucherformtest.htm?course_name=Bushcraft+Weeke
nd+course&price_code=SWC

>
> This error only occurs in IE not firefox

An error occurs in Firefox (2.0.0.8).  Select the Tools menu, Error Console
item (or whatever debugging tool you employ -- to http://getfirebug.com/ is
strongly recommended.)

> P.S. Please reply to this group rather than by email - thanks.

The opposite would be abnormal and generally unwished for in Usenet, so
there is not really a need for asking for it in an OP.  (Nevertheless, there
must be an address in the From header, meaning it designates a container
that receives e-mail; see RFC1036 and RFC2822.)

PointedEars
Signature

   realism:    HTML 4.01 Strict
   evangelism: XHTML 1.0 Strict
   madness:    XHTML 1.1 as application/xhtml+xml
                                                   -- Bjoern Hoehrmann

redog6@hotmail.com - 25 Oct 2007 09:34 GMT
Apologies - I forgot to upload one file at the time I posted so the
error response was not as described - it is now - please try it again
and see if you can help me out - many thanks.

Regards
Redge.
Thomas 'PointedEars' Lahn - 25 Oct 2007 11:13 GMT
> Apologies - I forgot to upload one file at the time I posted so the
> error response was not as described - it is now - please try it again
> and see if you can help me out - many thanks.

Same error (uncached):

urchinTracker is not defined
http://www.wildwoodbushcraft.com/voucherformtest.htm?course_name=Bushcraft+Weeke
nd+course&price_code=SWC

Line: 248
Code: urchinTracker();

Since `urchinTracker' appears to be a method, that would be the explanation
why IE shows the unhelpful "undefined is null or not an object" error
message: `undefined' cannot be called.

ISTM it is your using Google Analytics at the end of the `body' element (and
possibly also your serving invalid markup -- <http://validator.w3.org/>)
that causes the problem.  Incidentally, Google's client-side script code is
recognized here to have been written by in[ae]pt people.

PointedEars
Signature

Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
 -- Richard Cornford, cljs, <f806at$ail$1$8300dec7@news.demon.co.uk>

redog6@hotmail.com - 25 Oct 2007 19:47 GMT
Thanks for your advice Thomas...

> ISTM it is your using Google Analytics at the end of the `body' element (and
> possibly also your serving invalid markup -- <http://validator.w3.org/>)
> that causes the problem.  
Actually I have placed the Analytics tag exactly where Google say to
put it and the validator code seems strict xhtml and I am not sure why
it would create this error as other pages with transitional or loose
syntax and also Analytics tags in the same place do not give the
error... perhaps I am missing something here but I am still not sure
how to progress.

regards
Redge
Thomas 'PointedEars' Lahn - 25 Oct 2007 20:44 GMT
[Quoting repaired]

> [Thomas 'PointedEars' Lahn wrote:]
>> ISTM it is your using Google Analytics at the end of the `body' element (and
[quoted text clipped - 3 lines]
> Actually I have placed the Analytics tag exactly where Google say to
> put it

You misunderstood me.  I did _not_ mean to say that the position of the
"Analytics tag", which is rather a `script' element containing a call to
Google Analytics code, was wrong.  Mentioning the position was merely a way
to point you directly to the line where the problem appears to occur.

> and the validator code seems strict xhtml

Parse error.  *Your* code is _not_ valid.

http://validator.w3.org/check?verbose=1&ss=1&uri=http%3A%2F%2Fwww.wildwoodbushcr
aft.com%2Fvoucherformtest.htm%3Fcourse_name%3DBushcraft%2BWeekend%2Bcourse%26pri
ce_code%3DSWC


shows 12 errors, and that is assuming HTML 4.01 Transitional because you
omitted the required DOCTYPE declaration in your code.

> and I am not sure why it would create this error as other pages with
> transitional or loose syntax and also Analytics tags in the same place
> do not give the error...

Would that not be an indication that Google Analytics, at least the way you
used it, does not work with XHTML?

> perhaps I am missing something here but I am still not sure how to progress.

Use Valid HTML 4.01, preferably Strict.

Please take heed on the FAQ on how to quote properly:
http://www.jibbering.com/faq/faq_notes/clj_posts.html#ps1Post

PointedEars
Signature

"Use any version of Microsoft Frontpage to create your site. (This won't
prevent people from viewing your source, but no one will want to steal it.)"
 -- from <http://www.vortex-webdesign.com/help/hidesource.htm>

redog6@hotmail.com - 25 Oct 2007 21:57 GMT
I have now updated the page to conform to valid html 4.0 Transitional
but the error still persists.
Evertjan. - 25 Oct 2007 22:01 GMT
wrote on 25 okt 2007 in comp.lang.javascript:

> I have now updated the page to conform to valid html 4.0 Transitional
> but the error still persists.

What error?

[please always quote on usenet, this is not email]

Signature

Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

redog6@hotmail.com - 26 Oct 2007 10:52 GMT
>  wrote on 25 okt 2007 in comp.lang.javascript:
>
[quoted text clipped - 9 lines]
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)

Sorry, I was talking about the original error "'undefined' is null or
not an object". I have taken earlier advice which suggested that the
Javascript for my Google analytics combined with invalid mark up may
have been causing the error but although it may relate to another
error on validating the page and even removing the Analytics
javascript the "'undefined' is null or not an object" error still
persists.  I am not surprised since other pages with the same invalid
markup and Analytics tags do not produce the error.
David Mark - 26 Oct 2007 11:38 GMT
On Oct 26, 5:52 am, red...@hotmail.com wrote:

> >  wrote on 25 okt 2007 in comp.lang.javascript:
>
[quoted text clipped - 18 lines]
> persists.  I am not surprised since other pages with the same invalid
> markup and Analytics tags do not produce the error.

Here are some problems:

    var pfname, cemail, psurname, p_email, vvouchertype, vcoursedate,
vvoucher_email;

           with(window.document.msgform)
    {
        pfname = purchaser_firstname;
        cemail = purchaser_email;
        psurname = purchaser_surname;
        pemail = purchaser_email;
        vvouchertype = voucher_type;
        vcoursedate = course_date;
        vvoucher_email = voucher_email;

    }

There are so many things wrong with this, it is hard to know where to
begin.  First, don't use a with clause unless you know exactly what
you are doing and have a good reason for doing it (it isn't needed
here.)  Second, pemail is undeclared.  Third, read the FAQ section
about form element access.

The exception occurs in your trim function.  At some point you pass it
an undefined variable.
pr - 26 Oct 2007 13:24 GMT
> Sorry, I was talking about the original error "'undefined' is null or
> not an object". I have taken earlier advice which suggested that the
[quoted text clipped - 4 lines]
> persists.  I am not surprised since other pages with the same invalid
> markup and Analytics tags do not produce the error.

Looks like vvouchertype.value to me.

  http://www.jibbering.com/faq/faq_notes/form_access.html#faBut

shows you how to retrieve radio button values. Since the value of the
checked item is in the HTML, it's a puzzle as to why you should be
trying to trim it in any case.

I agree with David on the code quality: it's not a very obscure bug and
it's a worry that it takes so long to pinpoint it.
redog6@hotmail.com - 30 Oct 2007 12:29 GMT
> red...@hotmail.com wrote:
>
[quoted text clipped - 17 lines]
> I agree with David on the code quality: it's not a very obscure bug and
> it's a worry that it takes so long to pinpoint it.

Many thanks and also to David for your constructive comments - that
has solved the problem.
Thomas 'PointedEars' Lahn - 26 Oct 2007 13:39 GMT
>> [please always quote on usenet, this is not email]

JFTR: Quoting is useful with e-mail, too.

PointedEars
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.