Finbuckle.Html5Validation 1.0.0

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Finbuckle.Html5Validation --version 1.0.0                
NuGet\Install-Package Finbuckle.Html5Validation -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Finbuckle.Html5Validation" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Finbuckle.Html5Validation --version 1.0.0                
#r "nuget: Finbuckle.Html5Validation, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Finbuckle.Html5Validation as a Cake Addin
#addin nuget:?package=Finbuckle.Html5Validation&version=1.0.0

// Install Finbuckle.Html5Validation as a Cake Tool
#tool nuget:?package=Finbuckle.Html5Validation&version=1.0.0                

Finbuckle.Html5Validation

  1. Introduction(#introduction
  2. Supported Data Annotations
  3. Installation
  4. License

Introduction

Client form validation in ASP.NET Core sucks.

Specifically, tag helpers and HTMLHelper methods generate non-standard validation attributes and require the use of the jquery.validate and jquery.validate.unobtrusive libraries.

This library overrides this behavior to generate standard HTML5 validation attributes.

If you like this library, check out our main project Finbuckle.MultiTenant and consider becoming a sponsor.

Supported Data Annotations

The following data annotations are supported:

Attribute ASP.NET Core Finbuckle.Html5Validation
[Required] - data-val=true<br> - data-val-required="{message}" - required
[MinLength] - minlength="{min}"<br> - data-val=true<br> - data-val-minlength="{message}" <br>- data-val-maxlength-min="{min}" - minlength="{min}"
[MaxLength] - maxlength="{max}"<br> - data-val=true<br> - data-val-maxlength="{message}" <br>- data-val-maxlength-max="{max}" - maxlength="{max}"
[StringLength] - maxlength="{max}"<br> - data-val=true<br> - data-val-maxlength="{message}" <br>- data-val-maxlength-max="{max}" <br> - data-val-minlength="{message}" <br> - data-val-maxlength-min="{min}" - minlength="{min}"<br> - maxlength="{max}"
[Range] - data-val=true<br> - data-val-range="{message}"<br> - data-val-range-min="{min}" <br>- data-val-range-max="{max}" - min="{min}"<br> - max="{max}"
[RegularExpression] - data-val=true<br> - data-val-regex="{message}"<br> - data-val-regex-pattern="{regex}" - pattern="{regex}"
[DataType(DataType.{type}] - type="{type}"<br> - data-val-{type}="{message}"
[EmailAddress] - type="email"<br> - data-val-email="{message}" - type="email"
[Phone] - type="tel"<br> - data-val-phone="{message}" - type="tel"
[Url] - type="url"<br> - data-val-url="{message}" - type="url"

Note that [DataType(DataType.{type})] only supports simple types such as email, phone, and url.`

Installation

  1. Add the Finbuckle.Html5Validation NuGet package to your project.
2. In your app service configuration 
```csharp
using Finbuckle.Html5Validation;

var builder = WebApplication.CreateBuilder(args);

// ... Add normal services.

// Add Finbuclke.Html5Validation.
builder.Services.AddHtml5Validation();

// ... rest of file omitted.

License

This project is licensed under the MIT License. See LICENSE file for license information.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 384 6/21/2024
1.0.0 105 6/21/2024