Example of Validation in Blazor DateRangePicker Component
This example is used to validate form using the Data Annotation. Type the date range in the input element or choose the date range from the calendar popup. If the input value is a valid date range value, then the given input will be ready to submit. Otherwise, an error message will be shown until you enter or choose the valid date.
The form enables the validation with data annotation attributes by clicking on the submit externally. All rules are validated by the DataAnnotationsValidator
.
The above date range field is configured with the following rules.
Field | Rule |
---|---|
Required | The field must have valid start and end date values. |
Range | The field must have a date range value within the given range. The date should be between 5 March 2021 and 25 March 2021. |