'tagName' is null or not an object in IE8. not validating radio buttons in IE8 - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

'tagName' is null or not an object in IE8. not validating radio buttons in IE8

newb_123newb_123 IndiaPosts: 0Member

Hi,
I am using validatious-custom-0.9.1.js framework in my project and I am trying to validate required fields for radio buttons. But it is not validating the radio buttons in IE8. I am getting the following error in console
Message: 'tagName' is null or not an object
Line: 7
Char: 9921
Code: 0
URI: http://validatious.org/design/js/val....js?1256063644

HTML code used.

JS where it is failing - First 2 are the examples that are given in the framework file. So you will get to know how it is implemented

/* A radio button field is assumed to be either a list - ordered or unordered - with some element in front that acts as a label. This may be any element. If it is not in a list (ie the element does not have "li" parent elements), the label is assumed to be the element before the first input element.

Example1 (list approach):

<

h2>Favourite food/h2>

getLabel() will in this case return the h2 element.

Example2 (no list).



getLabel() will in this case return the first label element
*/

Actual code

getLabel: function() {
var parent = this.__elements[0].parentNode;
//alert(parent1.nodeName); --- Gives 'nodeName' is null or not an object IN Ie8
if (parent1.tagName.toLowerCase() === 'li') { ---Gives 'tagName' is null or not an object
return v2.$(parent1.parentNode).previous();
}

var element = v2.$(this.__elements[0]).previous();
return element || this.base();
}

Required field validation in the js file

v.reg('required', function(field, value, params) {
return !v2.empty(value) && !(typeof value.length !== 'undefined' && value.length == 0);

}, null, null, 'not-empty', false);

It works fine in firefox, IE7 and IE9. But in IE8, I get message tagName is null or not an object.

Can somebody please help me why its is giving error in IE8

Thanks in advance..

Tagged:
Sign In or Register to comment.