admin管理员组文章数量:1430432
Is there a lsit of what validation rule types are directly available, without having to code a new one?
e.g.
JQuery.validation has "min(value)"
But I have tried
var rule = new ModelClientValidationRule();
rule.ErrorMessage = ErrorMessage;
rule.ValidationParameters.Add("required", true);
rule.ValidationParameters.Add("min", _minDate);
rule.ValidationType = "min";
yield return rule;
without success.
Are the only options the inherited classes?
Is there a lsit of what validation rule types are directly available, without having to code a new one?
e.g.
JQuery.validation has "min(value)"
But I have tried
var rule = new ModelClientValidationRule();
rule.ErrorMessage = ErrorMessage;
rule.ValidationParameters.Add("required", true);
rule.ValidationParameters.Add("min", _minDate);
rule.ValidationType = "min";
yield return rule;
without success.
Are the only options the inherited classes?
Share Improve this question edited Nov 1, 2018 at 7:46 dove 20.7k14 gold badges86 silver badges108 bronze badges asked Dec 6, 2012 at 9:24 ImmortalStrawberryImmortalStrawberry 6,10116 gold badges86 silver badges133 bronze badges 02 Answers
Reset to default 5Taken from jquery documentation, I would suspect you cannot use date type but convert your date to a number and it will probably work.
Refer to Remote Client Side Validation with FluentValidation, you can make use of the existing remote validator by doing
var rule = new ModelClientValidationRule
{
ValidationType = "remote",
ErrorMessage = message
};
rule.ValidationParameters.Add("url", "/api/validation/uniqueemail");
yield return rule;
I think you can change the type you want to use by specify the ValidationType.
You can get the List of built-in Validation methods. Refer to that table, it includes the required and min you need.
本文标签: javascriptValid values for ModelClientValidationRule ValidationType stringStack Overflow
版权声明:本文标题:javascript - Valid values for ModelClientValidationRule ValidationType string? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745497369a2660868.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论