Custome message can be added in the validator addMethod, example below, the $.validator.messages.currency_limit carry the different message for different condition.
//value validation
jQuery.validator.addMethod("currency_limit", function(value, element) {
var cond = true;
if( $("#currency").val() == "sgd" ){
var maxAmt = 500;
if( value > 500 ){
$.validator.messages.currency_limit = "Maximum amount is "+maxAmt
return false;
}else if( value <= 500 ){ return true; }
}
if( $("#currency").val() == "usd" ){
var maxAmt = 10000000;
if( value > 10000000 ){
$.validator.messages.currency_limit = "Maximum amount is "+maxAmt
return false;
}
else if( value <= 10000000 ){
return true;
}
}
$.validator.messages.currency_limit
});
What do you think?