Skip to content

Commit c862761

Browse files
committed
Update readme
1 parent 23f1a0b commit c862761

File tree

1 file changed

+41
-2
lines changed

1 file changed

+41
-2
lines changed

README.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,41 @@
1-
# blazor-validation
2-
Blazor validation
1+
# Blazor-Validation
2+
3+
4+
Blazor-Validation is a validation agnostic library for validating forms in Blazor - [Microsoft aspdotnet Blazor project].
5+
6+
## Installation
7+
You can download the latest release / pre-release NuGet packages from the official NuGet pages:
8+
- [Blazor-Validation]
9+
- [Blazor-FluentValidation]
10+
11+
## Getting started
12+
1. Add a reference to PeterLeslieMorris.Blazor.Validation
13+
2. Inside the `<EditForm>` in your razor files, add `<PeterLeslieMorris.Blazor.Validation.Validate/>`
14+
3. In startup.cs add `using PeterLeslieMorris.Blazor.Validation` and then add the relevant validation in the `ConfigureServices` method.
15+
16+
- `services.AddFormValidation(config => config.AddDataAnnotationsValidation());`
17+
- `services.AddFormValidation(config => config.AddFluentValidation();`
18+
19+
It is possible to add as many validation providers as you wish
20+
```
21+
services.AddFormValidation(config =>
22+
config
23+
.AddDataAnnotationsValidation()
24+
.AddFluentValidation()
25+
);
26+
```
27+
28+
The standard Blazor components `<ValidationSummary>` and `<ValidationMessage>` will now work with your selected validation options.
29+
30+
31+
32+
### Sample projects
33+
More sample projects will be added as the framework develops.
34+
- [Data Annotations Sample] - Shows how to use DataAnnotations to validate.
35+
- [FluentValidation Sample] - Shows how to use the [FluentValidation.com] library to validate.
36+
37+
[Microsoft aspdotnet blazor project]: <https://github.com/aspnet/Blazor>
38+
[Blazor-Validation]: <https://www.nuget.org/packages/PeterLeslieMorris.Blazor.Validation/>
39+
[Blazor-FluentValidation]: <https://www.nuget.org/packages/PeterLeslieMorris.Blazor.FluentValidation/>
40+
[Data Annotations Sample]: <https://github.com/mrpmorris/blazor-validation/tree/master/samples/01-DataAnnotationsValidation/>
41+
[FluentValidation Sample]: <https://github.com/mrpmorris/blazor-validation/tree/master/samples/02-FluentValidation/>>

0 commit comments

Comments
 (0)