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" />
<PackageReference Include="Sitepoint.UmbValidationAttributes" />
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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#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
#tool nuget:?package=Sitepoint.UmbValidationAttributes&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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
- The validation attributes check Umbraco's dictionary for the provided key.
- If a translation exists, it is used as the error message.
- If no translation is found, the fallback message is displayed.
| Product | Versions 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.
-
net9.0
- Microsoft.AspNetCore.Mvc.Core (>= 2.3.0)
- Microsoft.AspNetCore.Mvc.DataAnnotations (>= 2.3.0)
- Microsoft.Extensions.Localization (>= 9.0.1)
- Umbraco.Cms.Core (>= 15.4.3)
- Umbraco.Cms.Web.Common (>= 15.4.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.