ASP.NET MVC3: ValidationType ModelClientValidationRule

后端 未结 1 867
野性不改
野性不改 2020-12-19 09:53

I just created a sample MVC3 application to learn validation. It is using DataAnnotations. I have created a custom ValidationAttribute named CustomStartLet

相关标签:
1条回答
  • 2020-12-19 10:38

    I wanted to change it to something else like "anotherDefaultType"

    You can use only lowercase letters for the ValidationType property:

    rule.ValidationType = "anotherdefaulttype";
    

    and then adapt your client script to reflect this modification:

    jQuery.validator.unobtrusive.adapters.addSingleVal("anotherdefaulttype", "other");
    jQuery.validator.addMethod("anotherdefaulttype", function (val, element, other) {
        ...
    });
    
    0 讨论(0)
提交回复
热议问题