DelphiFAQ Home Search:

Error 'undefined' is null or not an object in Internet Explorer

 

comments29 comments. Current rating: 5 stars (11 votes). Leave comments and/ or rate it.

Question:

I am developing a web application using ExtJS and when I open my URL in Firefox (2), everything looks good and works well. In Internet Explorer (6) I get an error message

Error 'undefined' is null or not an object

Internet Explorer Javascript Error Message



Any ideas?

Answer:

I had the same error once. Look for any array of properties that has a trailing , (comma).
This can happen easily in ExtJS source code where frequently you will have a list of comma separated properties, then you delete the last one of those properties and you forget to remove the trailing comma.

Firefox doesn't complain, but Internet Explorer throws a cryptic error message.

The worst issue is that Internet Explorer gives you a line number and character position that seems worth nothing. It doesn't even tell you, in which source file your bug is.

Do you see the buggy comma in the example below? I marked it red, yet it's still not easy to spot. I guess my source code is messy :-|

  gridFruits = new Ext.grid.EditorGridPanel({
                        store: storeFruits,
                        cm: new Ext.grid.ColumnModel([
                         {header:"Fruit", width: 30, sortable:true, dataIndex:'group',
                                editor:new Ext.form.TextField({allowBlank:false })},

                         {header:"Vitamin", width: 15, sortable:true, dataIndex:'vitamin'},

                         {header:"Profile", width: 15, sortable:true, dataIndex:'profile',
                                renderer: displayProfile},
                        ]),
                        viewConfig: { forceFit: true },
                        sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
                        clicksToEdit:2,
                        height: 444
                    });

Comments:

You are on page 1 of 2, other pages: [1] 2
2009-01-13, 04:26:49
anonymous from India  
Hi you have very good habit to crate blogs especially in extjs.
I am beginner in extjs.can u send mail me palpandi.msc@gmail.com


2009-02-18, 09:31:24
anonymous from Switzerland  
rating
That saved my day! Thanks.
2009-04-06, 09:02:13
anonymous from India  
rating
Hey buddy ,
Thank u so much.
u'r solution fix ma problem.
u saved ma life :-)
2009-11-07, 07:34:17
anonymous from United Kingdom  
http://www.jslint.com

Put your javascript through that. It immediately helped me to resolve an error with an extra comma.
2009-11-29, 23:01:33
[hidden] from Romania  
rating
Hi !
I have an jquery script.

$(function() {
$('#lista_colectie a').imgPreview({
containerID: 'imgPreviewWithStyles',
srcAttr: 'rel',
imgCSS: {
// Limit preview size:
height: 200
},
// When container is shown:
onShow: function(link){
$('<span>' + $(link).text() + '</span>').appendTo(this);
},
// When container hides:
onHide: function(link){
$('span', this).remove();
}
});
});


I have this problem with the error when the page does not contains the #list_colectie a and the components of it.
I have no extra comma i suppose.
Can anybody help?
2010-01-20, 04:48:41
anonymous from Poland  
Thanks for that message! It helps me! I found my comma in my code, when the ie says that bug is in extjs
2010-02-25, 06:49:43
anonymous from Hyderabad, India  
hi
2010-04-14, 19:38:20   (updated: 2010-04-14, 19:39:32)
htucker@covenanttek.com from Keyport, United States  
rating
Thank you very much!
I've been pulling my hair out for hours trying to figure out what was wrong with my script that worked fine in FF but was flagged in in IE with a ''images[...].link' is null or not an object'' error.
Sure enough there was an extra comma in an array 50 lines of code down from the line flagged by IE.
All's working as it should now :)
2010-04-23, 04:53:42
anonymous from Pakistan  
rating
This post really was quite helpful.Thanks for sharing.
2010-05-25, 07:18:21
anonymous from India  
rating
2012-01-18, 09:50:02
twitter.com/AfreX from Netherlands  
rating
Case of
trailing comma of death
.

You can use the following reg expression for finding these trailing comma's

,\s*?\]
2012-01-26, 09:53:18
anonymous from United States  
Thank you so much! I struggled with this forever before I found this page!
2012-02-01, 16:24:28
anonymous from United States  
rating
Thanks a lot. You made my day!
2012-02-03, 06:09:49
simhadrisidhu@gmail.com  
Thank You Very Much ,. Its so useful to me . I really spend one day to find out the solution for this issue.
You are on page 1 of 2, other pages: [1] 2

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: