o[0] is undefined jquery.yiiactiveform.js Line 21

I have a form which is causing this javascript error. I really don’t know where the error comes from, but meanwhile I had to check o.length, having this patch:


--- framework/web/js/source/jquery.yiiactiveform.js 	(revisión: 863)

+++ framework/web/js/source/jquery.yiiactiveform.js 	(copia de trabajo)

@@ -17,13 +17,15 @@

     	*/

    	var getAFValue = function (o) {

            	var type = o.attr('type');

-           	if(o[0].tagName.toLowerCase()=='span') {

-                   	var c = [];

-                   	o.find(':checked').each(function () {

-                           	c.push(this.value);

-                   	});

-                   	return c.join(',');

-           	}

+  	if (o.length > 0) {

+     	if(o[0].tagName.toLowerCase()=='span') {

+        	var c = [];

+        	o.find(':checked').each(function () {

+           	c.push(this.value);

+        	});

+        	return c.join(',');

+     	}

+  	}

            	if (type === 'checkbox' || type === 'radio') {

                    	return o.filter(':checked').val();

            	} else {

Before I post a bug report, I’d like to know if this is really a bug in Yii or it’s a problem caused by my code, and if this is the case, what could be the cause. Thanks.

This was a known bug in Yii 1.1.9 among other similar, in Yii 1.1.10 is all fixed.