Questions tagged [foolproof-validation]

MVC Foolproof Validation is a library that complements the Data Annotation validation provided in ASP.NET MVC.

MVC Foolproof Validation is a library that complements the Data Annotation validation provided in ASP.NET MVC.

It's released under the Microsoft Public License.

65 questions
14
votes
3 answers

RequiredIf Conditional Validation for two variables in MVC4

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…
Md Aslam
  • 1,228
  • 8
  • 27
  • 61
5
votes
1 answer

Using Foolproof RequiredIf with an Enum

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 { …
Matthew
  • 9,851
  • 4
  • 46
  • 77
3
votes
3 answers

MVC Client Side Validation Summary not showing when Model is Invalid

I'm using the MVC Validation nuget package called MVC Foolproof Validation. I'm using it on my model to set a required to true if another model property was empty. The validation part works, as the ModelState is correctly set to invalid when the Id…
user48408
  • 3,234
  • 11
  • 39
  • 59
3
votes
0 answers

Foolproof RequiredIf Error Message Not Working

I have my model with: [RequiredIfTrue("OtherField", ErrorMessage = "The field {0} cannot be blank")] [Display(Name = "The Name")] public string Name { get; set; } I set the ErrorMessage then I was expecting that, in validation, the error message…
Jonny Piazzi
  • 3,684
  • 4
  • 34
  • 81
3
votes
2 answers

MVC Foolproof validation 'Sys is not defined'

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…
Swifty
  • 1,422
  • 2
  • 18
  • 38
3
votes
1 answer

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

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…
2
votes
1 answer

FoolProof RequiredIf in Dot Net core

I am migrating my MVC project to Dot net core and have been trying to fix old conditional formatting on a field that was working fine in the MVC project. I am putting the validation on the Assumption field to be mandatory if the CategoryId is…
2
votes
1 answer

GreaterThan and LessThan as DataAnnotation on the same Attribute

i'm trying to do a condition on a attribute having DateTime as a type,it has to be greaterThan another attribute of the same Object and lessThan another which is also an attribute of the same Object.My probleme is when i try to apply these two…
2
votes
1 answer

ASP.NET MVC. Is it possible to use MVC Foolproof Validation for array validation?

E.g. I have the following model: public class MyModel { public Line[] Lines{get;set;} } public class Line { public int Quantity{get;set;} public int MaxQuantity{get;set;} } The "Quantity" field should be less than "MaxQuantity" so I tried to use…
Andrei
  • 4,237
  • 3
  • 25
  • 31
2
votes
1 answer

Foolproof RequiredIfTrue not working for MVC5?

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.…
James123
  • 11,184
  • 66
  • 189
  • 343
2
votes
2 answers

Manually trigger foolproof validation

I'm using Foolproof Validation so I can use [RequiredIf] attributes on my view model. The problem is that I'd like to trigger validation within my code using the same logic outside a controller. I've tried creating my own validation context and…
Michael La Voie
  • 27,772
  • 14
  • 72
  • 92
2
votes
1 answer

MVC Foolproof Validation with ASP.NET MVC WEB API project

It seems Foolproof Validation does not work with WEB API: // POST api/values public void Post(MyModel model) { } public class MyModel { public int Id { get; set; } public bool Condition { get; set; } [RequiredIfFalse("Condition")] …
Ievgen Martynov
  • 7,870
  • 8
  • 36
  • 52
1
vote
0 answers

requiredif on an element in a list of custom inputs

I have a modelview that contains a list of ICustomInput values public class DemoViewModel { [Required] public string FirstName {get; set;} [Required] public string LastName {get; set;} [RequiredIf("DayPhoneRequired", true)] …
1
vote
1 answer

M-V-C Fool-proof not working and showing Uncaught error?

I installed Fool-Proof from nuGet, but its not working uncaught errors. Install-Package foolproof -Version 0.9.4518 As I installed it, new folder with name Clients Scripts gets added in to my project with three libraries: FoolProof Unobtrusive,…
John Adam
  • 220
  • 2
  • 14
1
vote
0 answers

MVC Foolproof Unobtrusive date comparison format

I'm trying to validate an EndDate to be greater than a StartDate using MVC Foolproof Unobtrusive validation. The problem is that it's using American date format, while my app is supposed to be in European date format. i.e. a period of 03/02 - 02/03…
1
2 3 4 5