Search code examples
c#asp.netvalidationclient-side-validation

RequiredIf not working in MVC 5?


I would like to know if there exists RequiredIf annotation in MVC 5 because I'm in trouble trying to use it because it seems that it doesn't exists in MVC 5. Is there any solution, or I'm missing some library? (I know it exists in MVC3).

Also is there any alternative for conditional validation in MVC 5?

Thanks in advance.


Solution

  • Required if is not a built-in attribute. You need to download and import third party library:

    MVC Foolproof Validation