Unobtrusive client validation using ovld.js and ovld.unobtrusive.js
Client validation will trigger on input and change for each individual editor, also for all editors when clicking the submit button.
Validation rules are being read from the unobtrusive html attributes which are generated by the asp.net core library based on the validation attributes applied on the ViewModel properties.
[DisplayName("Checkbox")] public bool Organic { get; set; }
[UIHint("ChkEmpVal")] [Required(ErrorMessage = "This must be checked, in order to submit the form")] [DisplayName("Checkbox (Required)")] public bool Organic2 { get; set; }
[UIHint("TogglEmpVal")] [Required(ErrorMessage = "This must be Yes, in order to submit the form")] [DisplayName("Toggle Button")] public bool Organic3 { get; set; }
[UIHint("SchkEmpVal")] [Required(ErrorMessage = "This must be checked, in order to submit the form")] public bool OrganicSim { get; set; } } }
Comments
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our cookie policy and privacy policy.