foolproof-validation

Complex Custom Validation in Foolproof Validation

核能气质少年 提交于 2019-12-24 14:02:09
问题 I have implemented Complex custom Foolproof validation in my application from this link but sadly its not working.My requirement is simple,I have a input file for uploading an image and there should be a validation if the user chooses to upload file other than specified below ".jpg",".png",".gif",".jpeg" Code is [Required(ErrorMessage = "Please upload Photo", AllowEmptyStrings = false)] [IsValidPhoto(ErrorMessage="Please select files of type .jpg,.png,.gif,.jpeg")] public HttpPostedFileBase

Foolproof RequiredIf condition with false status not working

自古美人都是妖i 提交于 2019-12-13 21:05:18
问题 I have a JoinStatus field with True or False condition. I also have 2 textboxes named JoiningDate and NotJoiningReason .If user selects checkbox( True Condition ) JoiningDate textbox should be validated else ( False Condition ) NotJoiningReason textbox should be validated. I am trying to achieve this using Foolproof,but the problem is False Condition is not getting validated. ViewModel public bool JoinStatus { get; set; } [RequiredIf("JoinStatus",true,ErrorMessage="foooooooooooooooo")] public

MVC FoolProof Validation showing exception while calling SaveChange method

◇◆丶佛笑我妖孽 提交于 2019-12-12 03:24:12
问题 This question mayt sound duplicate but I am not satisfied with any of the answers as some are suggesting MVC Foolproof validaiton for conditional validaiton and some tells it dont work well with entity framework I am using MVC Foolproof RequiredIf validation in my project.It works well on clientside and is validation is working on server side as well. [RequiredIf("STCompulsory",Operator.EqualTo,true,ErrorMessage="Please enter Registration No")] public string STRegNo { get; set; } But when i

MVC Foolproof validation - Cannot read property 'value' of undefined

两盒软妹~` 提交于 2019-12-12 02:29:08
问题 I am using MVC Foolproof validation in my application. Scenario is I have a dropdownlist named CustomerType with the the following values Id Name 1 Student 2 Non-Employed 3 Employed 4 SelfEmployed and I have one more property in my viewmodel public string CompanyAddress{ get; set; } .My goal is to make CompanyAddress required if dropdownlist has values 3 or 4 I have tried the following [Required(ErrorMessage = "Please select status of the customer", AllowEmptyStrings = false)] public int?

Using Foolproof RequiredIf on multiplecondition

若如初见. 提交于 2019-12-11 10:26:45
问题 I have a dropdownlist named CustomerType with the the following values Id Name 1 Student 2 Non-Employed 3 Employed 4 SelfEmployed and I have one more property in my viewmodel public string CompanyAddress{ get; set; } My goal is to make CompanyAddress required if dropdownlist has values 3 or 4 I have tried the following but gets error Cannon have duplicate RequiredIf [RequiredIf("customerTypeID", 3, ErrorMessage = "Please enter company address")] [RequiredIf("customerTypeID", 4, ErrorMessage =

MVC Foolproof validation 'Sys is not defined'

筅森魡賤 提交于 2019-12-10 21:10:50
问题 I used the package manager console to install these two packages: foolproof & MvcExtentions.Foolproof. I included the foolproof script files in my bundle config (see below). Note that I didn't implement any foolproof code yet, I only installed the pacakges and included the script files and then ran the app. I'm getting the following clientside error: MvcFoolproofValidation.js: Uncaught ReferenceError: Sys is not defined bundles.Add(new ScriptBundle("~/bundles/jquery").Include( "~/Scripts

RequiredIf Conditional Validation for two variables in MVC4

喜夏-厌秋 提交于 2019-12-09 10:26:38
问题 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 回答1: Maybe try this in your model: [Required]

Foolproof RequiredIfTrue not working for MVC5?

你离开我真会死。 提交于 2019-12-08 07:56:24
问题 I am trying conditional required field. If user selects ContactByPhone checkbox I am showing ContactPhoneNumber field and it should be required filed. If user doesn't select ContactByPhone then ContactPhoneNumber is invisible and not required. Validation is not showing on client side. and after I submit the form ModelState.IsValid is false for this property. How to handle this? I think I referenced all scripts on the page. Do we have any alternative solution for this situation? Model public

Using Foolproof RequiredIf with an Enum

删除回忆录丶 提交于 2019-12-07 10:08:33
问题 We are trying to use the Foolproof validation annotation [RequiredIf] to check if an email address is needed. We also created an enum to avoid using a lookup table id in the ViewModel. The code looks like this: public enum NotificationMethods { Email = 1, Fax = 2 } Then in the ViewModel: [RequiredIf("NotificationMethodID", NotificationMethods.Email)] public string email {get; set;} In this senario we do not get an error when email is unfilled but selected as the notification type. Conversely

Foolproof RequiredIfTrue not working for MVC5?

☆樱花仙子☆ 提交于 2019-12-07 09:55:31
I am trying conditional required field. If user selects ContactByPhone checkbox I am showing ContactPhoneNumber field and it should be required filed. If user doesn't select ContactByPhone then ContactPhoneNumber is invisible and not required. Validation is not showing on client side. and after I submit the form ModelState.IsValid is false for this property. How to handle this? I think I referenced all scripts on the page. Do we have any alternative solution for this situation? Model public class Contact { [Display(Name = "by Phone")] public bool ContactByPhone { get; set; } [RequiredIfTrue(