Error from common.js
I am getting a js error: 'undefined' is null or not an object.
The problem is that var obj = AW.all[tag]; in the AW.object function is setting obj to undefined and the code is erroring in the return line of AW.dispatch function (both shown below).
Any ideas?
AW.object = function(id){
var parts = id.split("-");
var tag = parts[0];
var obj = AW.all[tag];
var target = obj;
alert("tag is " + tag);
alert("obj is " + obj);
for (var i=1; i<parts.length; i++){
if (obj["_" + parts[i] + "Content"]){
for (var j=i; j<parts.length; j++){
target = target.getContent(parts[j]);
}
break;
}
else if (parts[i+1] && parts[i+1].match(/^(\d+)$/)){
if (parts[i+2] && parts[i+2].match(/^(\d+)$/)){
if (parts[i+3] && parts[i+3].match(/^(\d+)$/)){
obj = obj.getTemplate(parts[i], parts[i+1], parts[i+2], parts[i+3]);
i += 3;
}
else {
obj = obj.getTemplate(parts[i], parts[i+1], parts[i+2]);
i += 2;
}
}
else {
obj = obj.getTemplate(parts[i], parts[i+1]);
i += 1;
}
}
else {
obj = obj.getTemplate(parts[i]);
}
target = obj;
}
return target;
};
var events = {
"DOMFocusIn": "focus"
};
AW.dispatch = function(element, event){
var type = "_on" + (events[event.type] || event.type) + "Event";
var target = AW.object(element.id);
var obj = target;
while (obj && obj._parent){
obj = obj._parent;
}
return target[type].call(obj, event);
};
The problem is that var obj = AW.all[tag]; in the AW.object function is setting obj to undefined and the code is erroring in the return line of AW.dispatch function (both shown below).
Any ideas?
AW.object = function(id){
var parts = id.split("-");
var tag = parts[0];
var obj = AW.all[tag];
var target = obj;
alert("tag is " + tag);
alert("obj is " + obj);
for (var i=1; i<parts.length; i++){
if (obj["_" + parts[i] + "Content"]){
for (var j=i; j<parts.length; j++){
target = target.getContent(parts[j]);
}
break;
}
else if (parts[i+1] && parts[i+1].match(/^(\d+)$/)){
if (parts[i+2] && parts[i+2].match(/^(\d+)$/)){
if (parts[i+3] && parts[i+3].match(/^(\d+)$/)){
obj = obj.getTemplate(parts[i], parts[i+1], parts[i+2], parts[i+3]);
i += 3;
}
else {
obj = obj.getTemplate(parts[i], parts[i+1], parts[i+2]);
i += 2;
}
}
else {
obj = obj.getTemplate(parts[i], parts[i+1]);
i += 1;
}
}
else {
obj = obj.getTemplate(parts[i]);
}
target = obj;
}
return target;
};
var events = {
"DOMFocusIn": "focus"
};
AW.dispatch = function(element, event){
var type = "_on" + (events[event.type] || event.type) + "Event";
var target = AW.object(element.id);
var obj = target;
while (obj && obj._parent){
obj = obj._parent;
}
return target[type].call(obj, event);
};
John W
December 8,