Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asp.Net Core validation without jQuery

Is there any mode to use Asp.Net Core client side validation without jquery + jquery validation + jq unobtrusive validation? I mean it's 2017, every browser can handle lots of HTML5 input validators without JavaScript.

like image 833
martonx Avatar asked Mar 31 '17 21:03

martonx


People also ask

How can use client side validation in asp net core?

The ASP.NET core includes unobtrusive client-side validation libraries, which makes it easier to add client side validation code, without writing a single line of code. In the previous tutorial on server side validation, we looked at how data annotations attributes are used by the Model Validator to validate the Model.

Which of the following are alternatives to perform model validation instead of using built in validation attributes?

Alternatives to built-in attributes If you need validation not provided by built-in attributes, you can: Create custom attributes. Implement IValidatableObject.

What is ModelState in asp net core?

When we talk about ModelState , we mean ModelState property of the ControllerBase abstract class in the Microsoft. AspNetCore. Mvc namespace. It is of ModelStateDictionary type and it represents errors that come from two subsystems: model binding and model validation.


1 Answers

I created a library that is compatible with the original validation library but is much smaller and does not require jQuery. You can use it as a drop-in replacement if you want to reduce payload size of your assets:

https://github.com/kraaden/unobtrusive-validation

like image 174
Denys Krasnoshchok Avatar answered Sep 27 '22 20:09

Denys Krasnoshchok