views:

142

answers:

1

OK, beating my head against the Javascript/jQuery wall over here, here is the code, which I simply can't get to work properly, any help is highly appreciated!

Especially this bugs me, changing row 60 from
c.gbForm.validator = c.dom.gbForm.validate(c.gbForm.validator); to
c.gbForm.validator = $("#gbForm").validate(c.gbForm.validator);
and row 61 from
c.dom.gbForm.unbind('submit').submit(c.gbForm.doAdd); to
$("#gbForm").unbind('submit').submit(c.gbForm.doAdd);
makes it kinda work, except then I get this[0] is undefined error which I think is the jQuery validate plugin but I simply can't locate the exact spot at fault... So any hints/pointers to why the whole "var c" business isn't working and the same for the "this[0]" part would be awesome!

Thanks for any assistance!
John

+1  A: 

Yes, here are a few things to look at

c.gbForm.validator = $("#gbForm").validate(c.gbForm.validator);

here you are referencing c.gbForm.validator before it is set (assuming this is the first assignment to c.gbForm.validator).

try this.

c.gbForm.validator = $("#gbForm");
c.gbForm.validator = $("#gbForm").validate(c.gbForm.validator);

also, why do you call c.doc.gbForm in one spot and just c.gbForm in another?

and as the comment says, validation should be as simple as $("gbForm").validate();

Russell Steen