Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:

XML
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 };
       }


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?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900