Overview

The DevExpress UI components support Blazor's form validation. You can read about the Blazor forms and validation in the official documentation.

In the demo examples we will use the Starship class that defines validation logic based on data annotations. This class has been taken from the official documentation with only slight modifications.

Form Layout

Form Validation State: Press the "Submit" button to validate the form.

Our Form Layout component allows you to easily construct responsive and automatically-aligned edit forms. The standard EditForm component enables data validation. This demo shows how you can use the two components together.

Inside the EditForm, the code adds a Form Layout component with four layout items. Each item contains a DevExpress Data Editor:

The EditForm also contains the DevExpress Button component with the SubmitFormOnClick option set to true. As in the previous demo, once you attempt to submit changes, editors become marked with colored outlines. Red indicates invalid values, while green indicates values that were posted successfully.

Below the form the standard Blazor ValidationSummary component displays the validation summary.

Custom Form

Form Validation State: Press the "Submit" button to validate the form.

The following example shows a standard EditForm component with a few DevExpress editors in it:

Once you attempt to submit changes, editors become marked with colored outlines. Red indicates invalid values, while green indicates values that were posted successfully.

The code also adds a standard ValidationMessage component for each editor to display error messages.