Blazor TextBox - Form Validation
This example demonstrates form validation using Data Annotation attributes. Type a value in the input element. If the input value is valid, the input will be ready to submit. Otherwise, an error message will be displayed until you enter a valid value.
The form enables validation with data annotation attributes when the submit button is clicked externally. All validation rules are enforced by the DataAnnotationsValidator component.
Name Field Validation Rules:
| Field | Rule |
|---|---|
| Required | The field must have a valid value. |
| MinLength | The field must have more than 3 characters in length. |
| MaxLength | The field should not have more than 10 characters in length. |
Address Field Validation Rule:
| Field | Rule |
|---|---|
| Required | The field must have a valid value. |