AlexB
AlexB

Reputation: 4546

Disable client side form validation in ASP.NET Core

How can I disable client-side form validation in my ASP.NET Core 1.1 app? But I need the server-side one.

Upvotes: 8

Views: 6099

Answers (3)

RickAndMSFT
RickAndMSFT

Reputation: 22860

In Razor Pages

services.Configure<HtmlHelperOptions>(o => o.ClientValidationEnabled = false);

See Disable client-side validation

Upvotes: 1

MaxT
MaxT

Reputation: 271

You do this in your ConfigureServices class in your Startup file:

services.AddMvc().AddViewOptions(options => 
    options.HtmlHelperOptions.ClientValidationEnabled = false);

This will work for the attributes generated by tag helpers.

Upvotes: 10

Joe Audette
Joe Audette

Reputation: 36736

you just remove the javascript for jquery.unobtrusive.validation.js

In the VS project templates that is in _ValidationScriptsPartial.cshtml

Upvotes: 7

Related Questions