使用IClientValidatable进行自定义客户端验证。 ASP .NET MVC 4 [英] Custom Client side validation using IClientValidatable. ASP .NET MVC 4
问题描述
Hello All,
我正在尝试实现自定义客户端验证。它是一个交叉耦合验证。我已经遵循了所有步骤并且工作正常。但是我的要求要求我修改ErrorMessage,它将成为元数据的一部分(HTML 5数据属性)。示例如下
IClientValidatable实现:
Hello All,
I am trying implement custom client side validation.It is a cross coupled validation. I have followed all steps and its working fine. But my requirement requires me to modify the ErrorMessage which is will be part of metadata(HTML 5 Data Attribute). The example is as follows
IClientValidatable implementation:
public IEnumerable<ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context)
{
ModelClientValidationRule rule = new ModelClientValidationRule();
rule.ValidationType = "salaryandloanconstraint";
rule.ValidationParameters.Add("loanconstraintvalue", _loanEligibleMultiplicity);
rule.ErrorMessage = "Salary Insufficient to sanction a loan amount of";
return new ModelClientValidationRule[] { rule };
}
我已经为rule.ErrorMessage启动的消息不完整。我想将用于LoanAmount属性的输入字段中的文本附加到用户输入时的错误消息。
总结是否有任何方法可以操作客户端使用JQuery的错误消息(HTML5 DATA ATTRIBUTES)?
The message which i have initilized to rule.ErrorMessage is incomplete. I want to append text which is taken from input feild for LoanAmount property to the error message when the user enters.
In Summary is there any way which i can manipulate the error message(HTML5 DATA ATTRIBUTES) at the client side using JQuery?
推荐答案
将一个黑鬼小伙子贴上你的**洞
stick a nigger dick up your a**hole
这篇关于使用IClientValidatable进行自定义客户端验证。 ASP .NET MVC 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!