Sitepoint.UmbValidationAttributes 1.0.3

dotnet add package Sitepoint.UmbValidationAttributes --version 1.0.3
                    
NuGet\Install-Package Sitepoint.UmbValidationAttributes -Version 1.0.3
                    
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="Sitepoint.UmbValidationAttributes" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sitepoint.UmbValidationAttributes" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="Sitepoint.UmbValidationAttributes" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Sitepoint.UmbValidationAttributes --version 1.0.3
                    
#r "nuget: Sitepoint.UmbValidationAttributes, 1.0.3"
                    
#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.
#:package Sitepoint.UmbValidationAttributes@1.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Sitepoint.UmbValidationAttributes&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=Sitepoint.UmbValidationAttributes&version=1.0.3
                    
Install as a Cake Tool

UmbDictionary.Validation.Attributes

UmbValidationAttributes is a NuGet package that provides custom validation attributes for Umbraco forms. These attributes allow error messages to be translated dynamically using Umbraco's dictionary feature, with a fallback message if no dictionary entry is found.

Installation

Install the package via NuGet:

dotnet add package Sitepoint.UmbValidationAttributes

Usage

Apply the custom validation attributes to your model properties, specifying both the dictionary key and a fallback error message.

Example

public class FormModel
{
    [UmbRequire("Form.UmbRequire", "This field is required.")]
    [UmbMaxLength("Form.UmbMaxLength", "This field is too long.", 20)]
    [UmbMinLength("Form.UmbMinLength", "This field is too short.", 5)]
    public string? Name { get; set; }

    [UmbEmailAddress("Form.UmbEmailAddress", "Please enter a valid email address.")]
    public string? Email { get; set; }

    [DataType(DataType.Password)]
    public string? Password { get; set; }

    [DataType(DataType.Password)]
    [UmbCompare("Form.UmbCompare", "Passwords do not match.", "Password")]
    public string? ConfirmPassword { get; set; }
}

How It Works

  1. The validation attributes check Umbraco's dictionary for the provided key.
  2. If a translation exists, it is used as the error message.
  3. If no translation is found, the fallback message is displayed.
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.3 213 7/14/2025
1.0.2 143 2/15/2025
1.0.1 253 2/11/2025
1.0.0 141 2/11/2025