日期:2014-05-16 浏览次数:20436 次
<td> @Html.TextBoxFor(m => m.ActualInvoiceFee, new { @id = "txtActualInvoiceFee", @style = "width:80px", @class = "easyui-validatebox", @validType = @"VerifyMoney[{'maxVal':999999 ,'minVal':-999999},'只能输入数字']", @required = "true", @missingMessage = "必须填写发票金额" }) </td>
//add by gongth验证金额 $.extend($.fn.validatebox.defaults.rules, { VerifyMoney: { validator: function (value, param) { var reg = /^(|[+-]?(0|([1-9]\d*)|((0|([1-9]\d*))?\.\d{1,2})){1,1})$/; value = value.Trim(); if (reg.test(value)) { var maxVal = param[0]['maxVal']; var minVal = param[0]['minVal']; if (maxVal != null) { if (reg.test(maxVal)) { if (value > maxVal) { $.fn.validatebox.defaults.rules.VerifyMoney.message = "超出范围"; return false; } } } if (minVal != null) { if (reg.test(minVal)) { if (value < minVal) { $.fn.validatebox.defaults.rules.VerifyMoney.message = "超出范围"; return false; } } } return true; } else { $.fn.validatebox.defaults.rules.VerifyMoney.message = param[1]; return false; } }, message: '' } }); //end ageReg