[SOLVED] jquery validate - Cannot call method 'call' of undefined

[SOLVED] jquery validate - Cannot call method 'call' of undefined

Good afternoon,

I think i found a bug with a cutom validation rule.
When the form is submited without modify any field, the custom rule is called. But if you set email field and give a password, you get an error (tests realised with chrome) :

Uncaught TypeError: Cannot call method 'call' of undefined

  1. a.extend.check jquery.validate.min.js:4
  2. a.extend.element jquery.validate.min.js:4
  3. a.extend.defaults.java-script jquery.validate.min.js:4
  4. a.extend.validateDelegate jquery.validate.min.js:4
  5. m.event.dispatch jquery.min.js:3
  6. m.event.add.r.handle jquery.min.js:3

 

I tried different versions of jquery and jquery validation, it is the same. I created a minimal code to reproduce it.

Can you help me ? Thanks in advance :)


  1. <!doctype html>
  2. <html>
  3. <head><title></title>

  4. <script src="jquery.min.js"></script>
  5. <script src="jquery.validate.min.js"></script>

  6. </head>
  7. <body>
  8. <script>
  9. $(document).ready(function(){

  10. function completed()
  11. {
  12.  return $("#aaa ul li").length == $(".aaa_selectedValue").length;
  13. }

  14. jQuery.validator.addMethod("isCompleted", function(value, element) {
  15. return completed();
  16. }, "Not finished");
  17. $("#formConnection").validate({
  18. ignore: ':hidden:not("#resultId")',
  19. rules: {
  20. login: { required: true, email:true },
  21. pwd: { required: true, password: true },
  22. result: {isCompleted : true}
  23. }
  24. });



  25. });
  26. </script>

  27. <form id="formConnection" action="" method="post" novalidate="novalidate">
  28. <label>E-mail *</label>
  29. <input type="text" name="login" value="">

  30. <label>Mot de passe *</label>
  31. <input type="password" name="pwd">

  32. <div id="aaa">
  33. <ul><li class="aaa_selection">a</li><li>b</li></ul>
  34. </div>

  35. <input type="hidden" name="result" id="resultId" value="">

  36. <input type="submit" id="btnConnection" name="validate" value="Connexion">

  37. </form>

  38. </body></html>

[MODERATOR: ADDED THE PAGE TO THE POST]