I'm trying out aspnetboilerplate and I love it so far. I downloaded the template with just ASP.NET Core MVC. The one thing I don't quite understand is when I have a Model class ie
public class CreateSubjektInput
{
[StringLength(11), Required]
public string Oib { get; set; }
}
When there is a Model error (eg stringlength = 5) I get an AbpValidationException
without even hitting the controller. So how to do client side validation like in aspnet core with jquery.unobtrusive? Or how to handle model errors? I read the documentation and I saw in sample projects the validation was in pure javascript. I'm lost here
First, read this document:
https://aspnetboilerplate.com/Pages/Documents/Validating-Data-Transfer-Objects
There are lot of different methods to doing this in ABP. Custom validation attributes, overriding existing modelState, jquery.unobtrusive, and etc.
Big part of validation code is here:
https://github.com/aspnetboilerplate/aspnetboilerplate/tree/dev/src/Abp/Runtime/Validation
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.