Skip to content

No client-side validation support in FluentValidation 12 #7844

@DmitriyKulagin

Description

@DmitriyKulagin

After upgrading from FluentValidation.AspNetCore (v11.x) to FluentValidation (v12.x), client-side validation stopped working.

Previously, when using

services.AddFluentValidationAutoValidation()
        .AddFluentValidationClientsideAdapters();

ASP.NET Core views would generate data-val-* attributes (e.g. data-val="true", data-val-required="...") which allowed jQuery Validate + jQuery Validate Unobtrusive to perform client-side validation.

In FluentValidation 12, the package FluentValidation.AspNetCore was removed/marked obsolete, and the new recommended approach is to use only FluentValidation with a global filter for server-side validation. However, there seems to be no replacement for the client-side adapters.

As a result: asp-validation-for spans are rendered, but no data-val-* attributes are generated for input fields, meaning jQuery Unobtrusive Validation does not work anymore.

Let's discuss what could be the solution (NuGet package or built-in adapters) to map FluentValidation rules to data-val-* attributes so that client-side validation works the same as in FluentValidation 11.

P.S. Until a solution is found, we will use FluentValidation.AspNetCore.

See also: Adding client-side validation to ASP.NET Core, without jQuery or unobtrusive validation

Metadata

Metadata

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions