jQuery.Validate is an awesome plugin.. Albeit with a few minor issues.
This one happens when using the $.format function which is part of jquery.validate 1.7 and previous versions too.
When you use the $.format like this:
$.format(“Hello {0} ”, userName)
if the userName variable is null then this will be the outcome: “Hello null”
To fix this issue you can add this simple line to the $.format function to make sure the value is not null before merging it with your string.
This:
$.each(params, function(i, n) {
source = source.replace(new RegExp(“\\{” + i + “\\}”, “g”), n);
});
Becomes this:
$.each(params, function(i, n) {
if (n == null) n = ”;
source = source.replace(new RegExp(“\\{” + i + “\\}”, “g”), n);
});
See the video bellow for the bug and fix in action.
http://www.screencast.com/t/MGZlNjAxMDkt
Hope this helps!
Mitch



