HI
我有自定义验证器,用于比较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;
}
}
答案 0 :(得分:0)
得到它自己。 tbxProbableSalesPriceQuickSale.Attributes.Add(“onchange”,“Page_ClientValidate('');”);