你好
我有自定义验证器,用于比较 2 个文本框中的值以查看 1 是否大于另一个。此自定义验证器应用于文本框 1。但如果我更改文本框 2 中的值,我希望再次触发此验证,以便如果用户修复值以通过比较,则验证器将更新。我怎样才能做到这一点。自定义验证器只是进行客户端验证。
function ValidateProbableSalesPriceAsIs(sender, args) {
var tbxProbableSalesPriceAsIs = $("#<%= tbxProbableSalesPriceAsIs.ClientID %>").val();
var probableSalesPriceAsIs = isNaN(parseFloat(tbxProbableSalesPriceAsIs.replace(/[,]/g, ""))) ? 0 : parseFloat(tbxProbableSalesPriceAsIs.replace(/[,]/g, ""));
var cell = sender.ValidatorCalloutBehavior._errorMessageCell;
var tbxProbableSalesPriceQuickSale = $("#<%= tbxProbableSalesPriceQuickSale.ClientID %>").val();
var probableSalesPriceQuickSale = isNaN(parseFloat(tbxProbableSalesPriceQuickSale.replace(/[,]/g, ""))) ? 0 : parseFloat(tbxProbableSalesPriceQuickSale.replace(/[,]/g, ""));
if (probableSalesPriceAsIs <= probableSalesPriceQuickSale) {
if (cell != null) {
cell.innerHTML = "Probable Sales Price As Is Value must be greater than Quick Sale Value";
}
sender.errormessage = "Probable Sales Price As Is Value must be greater than Quick Sale Value";
args.IsValid = false;
}
}