[jQuery] Validation Plugin - addMethod

[jQuery] Validation Plugin - addMethod


Hello, I am having a little problem understanding the addMethod
function of the validation plugin. I am trying to do a simple test
like this:
I've placed this code outside of the $().ready():
JQuery.validator.addMethod('testMethod', function(str1, str2) {
    alert("testing....");
    alert("str1 is " + str1 + "\nstr2 is " + str2);
    return false;
}, 'some message');
and this inside of $().ready():
$("#medForm").validate({
            rules: {
                medication : "required",
                dosage: "required",
                startDate : "date",
                endDate : {date : true, testMethod : {"this is", "a test"}}
            },
            messages: {
                medication: "Please provide a medication name",
                dosage: "Please provide your dosage",
                startDate: "Please enter a date in mm/dd/yyyy format<br/>or select
one from the calendar",
                endDate: "Please enter a date in mm/dd/yyyy format<br/>or select
one from the calendar"
            }
});
Here I am trying to apply the testMethod validation to the endDate
field. When I use the form, the other validation works, but the
testMethod function is never called (no alerts are seen and the error
message never shows up under the field [the method is set to return
false no matter what]). I tried to look at the documentation for this
on the JQuery website, but there are no examples of how to attach a
custom method to a form field..
Thanks for any help!