[validate] no validation method dateDE BUT possible solution!
Hi all,
I'm quite new to jquery and a total noob, however today I came across this nice validation plugin but had some problems with it.
I downloaded it via the "Download" link from http://bassistance.de/jquery-plugins/jquery-plugin-validation/
I have a small form where a German date (i.e. 1.1.2011 or 01.01.2011) should be inserted by a user.
So looked up the API on http://docs.jquery.com/Plugins/Validation#Options_for_the_validate.28.29_method
for the needed method and there it was documented: dateDE
However it did not work, my form would submit if anything was inserted into the input field.
I have the following scripts defined in my html file:
Jquery min v1.4.2 and jquery.validate.js
So I did some Google searches and some searches here, and couldn't find anything.
Searching through the additional-methods.js, I still couldn't find the method.
Looking at the jquery.validate.js I noticed there was no dateDE defined, just "date" and "dateISO"
I'm not sure if this is already known, or intentional - but it seems to me that the dateDE method REALLY IS missing.
However I fixed it for me and want to share (not sure if "share-worthy" but I'll do it anyway)
So I added it myself the following to jquery.validate.js on line 1019 (just between date and dateISO):
dateDE: function(value, element) {
return this.optional(element) || /^\d{1,2}["."]\d{1,2}["."]\d{4}$/.test(value);
any comments welcome!
cheers
d.