foolproof-validation

How to make unobtrusive client-side validation work with Foolproof's ModelAwareValidationAttribute

天大地大妈咪最大 提交于 2019-12-05 02:39:21
问题 I'm trying to make use of the MVC Foolproof Validation framework (http://foolproof.codeplex.com/) but I'm having trouble with the ModelAwareValidationAttribute class. When I add a custom validation attribute, it works fine for server-side model validation, but not on the client-side. If I use one of the built-in attributes supplied by the framework, client-side unobtrusive validation works, so I know (or at least I think I know) that I have the correct javascript libraries loaded. Has anyone

How to make unobtrusive client-side validation work with Foolproof's ModelAwareValidationAttribute

时光毁灭记忆、已成空白 提交于 2019-12-03 17:38:11
I'm trying to make use of the MVC Foolproof Validation framework ( http://foolproof.codeplex.com/ ) but I'm having trouble with the ModelAwareValidationAttribute class. When I add a custom validation attribute, it works fine for server-side model validation, but not on the client-side. If I use one of the built-in attributes supplied by the framework, client-side unobtrusive validation works, so I know (or at least I think I know) that I have the correct javascript libraries loaded. Has anyone out there created a custom validation attribute using this framework at does it work with client-side

RequiredIf Conditional Validation for two variables in MVC4

一个人想着一个人 提交于 2019-12-03 13:36:19
I have a model class that is following public bool Saturday{ get; set; } public bool Sunday{ get; set; } public string Holiday{ get; set; } In which I want to use the RequiredIf condition for the Holiday field using the both Saturday and Sunday fields. Can I use like following [RequiredIf("Sunday,Saturday",false)] public string Holiday{ get; set; } So I don't know how to use the RequiredIf condition in my model class, So please someone help me Maybe try this in your model: [Required] public bool Saturday{ get; set; } [Required] public bool Sunday{ get; set; } [NotMapped] public bool SatSun {

Foolproof multiple validators on the same fields

亡梦爱人 提交于 2019-12-02 22:20:33
问题 I currently use foolproof for that validation: [RequiredIfNot("type", 3, ErrorMessage = "Please enter at least one value")] public int[] audites { get; set; } but customer wants to add validation as that: [RequiredIfNot("type", 3, ErrorMessage = "Please enter at least one value")] [RequiredIfNot("nature", 1, ErrorMessage = "Please enter at least one value")] [RequiredIfNot("nature", 3, ErrorMessage = "Please enter at least one value")] public int[] audites { get; set; } But it compilator

How i do Required If validation by function in MVC5

懵懂的女人 提交于 2019-12-01 14:51:56
if email exist by function check i want display error how i do it? [RequiredIf(BL.datafuncs.checkIfExist(email) == true, ErrorMessage = "email already exist")] public string email { get; set; } The RequiredIf attribute is for validating a property that is required based on the value of another property. For example if you model contains properties bool NotifyMeByEmail and string EmailAddess then you could apply it as follows. public bool NotifyMeByEmail { get; set; } [RequiredIf("NotifyMeByEmail", ErrorMessage = "Please enter you email address")] public string EmailAddress { get; set; } Then

How i do Required If validation by function in MVC5

旧时模样 提交于 2019-12-01 13:28:43
问题 if email exist by function check i want display error how i do it? [RequiredIf(BL.datafuncs.checkIfExist(email) == true, ErrorMessage = "email already exist")] public string email { get; set; } 回答1: The RequiredIf attribute is for validating a property that is required based on the value of another property. For example if you model contains properties bool NotifyMeByEmail and string EmailAddess then you could apply it as follows. public bool NotifyMeByEmail { get; set; } [RequiredIf(