DelphiFAQ Home Search:

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

 

comments7 comments. Current rating: 5 stars (3 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:

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

 

 

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: