just a FYI - I spent most of yesterday with this issue or checking for undefined field or variable in Javascript - thought the following might be helpful to someone.

...people write

if (foo == null) {
foo = "Joe";
}

When what they really mean is

if (!foo) {
foo = "Joe";
}

see
http://saladwithsteve.com/2008/02/ja...d-vs-null.html