开发者

JQuery validator plug-in "date" works but "dateDE" throws error

开发者 https://www.devze.com 2023-01-15 01:01 出处:网络
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

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" an开发者_如何学Cd 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消