0

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

2
  • I presume the 2nd snippet has a syntax error from where you have typed it? Commented Jan 8, 2010 at 15:29
  • 1
    I would suggest just trying to get the validate to work without making all the extra objects. Just try $("#gbForm").validate({}) with all of your rules, messages, etc. Does that at least run? Commented Jan 8, 2010 at 19:45

1 Answer 1

1

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();

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.