I am trying to update the error message for a CustomValidator that uses a ValidatorCallOut via javascript. Basically its checking to see if a number entered is an increment of a specified number. I have some code that will update the error message the first time it is run, but after that it will no longer update the error message, although through javascript alerts I see the values are actually being updated. Here is the client side javascript validation function I'm using:
function checkIncrement(sender, args) {
var incrementValue = parseInt(sender.orderIncrement); // Custom attribute registered with RegisterExpandoAttribute
var remainder = args.Value % incrementValue;
if ((remainder) != 0) {
var remainder, lowRange, highRange;
lowRange = parseInt(args.Value - remainder);
highRange = parseInt(lowRange + incrementValue);
sender.errormessage = "Closest possible values are <b>" + lowRange + "</b> or <b>" + highRange + "</b>"; // Gets updated once, but not after that
alert("Low Range: " + lowRange); // always updated with current value
args.IsValid = false;
return;
}
args.IsValid = true;
}
Any idea on how to keep the error message updated every time this is run to validate?