i've added this to the top of my page jQuery.validator.addMethod("pCode", function(value) { // Addon method for validating postal codes. Valid formats are (X1X 1X1) or (X1X1X1) or (X1X-1X1). return value.match(/^[a-zA-Z][0-9][a-zA-Z](-| )?[0-9][a-zA-Z] [0-9]$/);
}, 'Please enter a valid postal code'); pCode works great. But when I try to put a conditional statement like this: $(myself).find("form").validate({ rules: { postalCode: { pCode: function(element) { alert($(myself).find("select[name=countryId]").val() != '800'); return ($(myself).find("select[name=countryId]").val() != '800' ); } } } the condition doesn't take. It validates my postalCode field regardless of what value is returned. the alert is even coming out as "false" for me and its still validating this field. I've tried hardcoding the function to "false" and it seems to work. Any ideas? I know its probably something stupid that I forgot