views:

20

answers:

1

Hi!

As basicly explained in the title I have a form with a date field. This beeing in Germany and all I would like to validate it against the provided "dateDE" validator. Here is my validator code

$("#aufuhrRecherche").validate({
   rules: {
     recherchegrund: "required",
     beginn: "dateDE",
     ende: "dateDE"
   },
   messages: {
     recherchegrund: "Bitte einen Recherchegrund angeben",
     beginn: "Bitte ein Anfangsdatum angeben",
     ende: "Bitte ein Enddatum angeben"
   },
   errorLabelContainer: "#error",
      wrapper: "li",       
      highlight: function(element, errorClass) {
          $(element).css('background-color', 'salmon');
       },
      unhighlight:function(element, errorClass) {
          $(element).css('background-color', 'white');
       }
  }
 );

Now using this code I get the following error in jquery.validator.js:

$.validator.methods[method] is undefined Line 492

Using just

beginn: "dateDE",
ende: "dateDE"

works just fine and the error pop up in a nice list where they should.

This is driving me insane. Has anybody seen this before?

EDIT

I just tried the exact same code with "dateISO" and it works. I am starting to think this is a bug with the jQuery validation plug-in. But still strange that I am the only one that has this problem.

+1  A: 

From jQuery validate plugin's Change Log: "The dateDE and numberDE methods were replaced with a localization/methods_de.js file". So include methods_de.js file.

Andrius
Thank you! I missed that. Too bad that the docu still refers to dateDE.
BernardMarx