Conditional Validation in MVC4

ASP.NET MVC 3 uses jquery unobtrusive validation to perform client side validation. So you could either write a custom RequiredIf validation attribute or use the one provided in Mvc Foolproof Validation and then: public class MyViewModel { [RequiredIf(“IsFlagSet”, true)] [Remote(“ValidateHosFin”, “EditEncounter”)] [MinLength(6)] public string HospitalFinNumber { get; set; } public bool IsFlagSet { get; set; … Read more

jQuery Validate – Enable validation for hidden fields

The plugin’s author says you should use “square brackets without the quotes”, [] Release: Validation Plugin 1.9.0: “…Another change should make the setup of forms with hidden elements easier, these are now ignored by default (option “ignore” has “:hidden” now as default). In theory, this could break an existing setup. In the unlikely case … Read more