Input Validation

 
First Name Last Name Title Title Of Courtesy Birth Date Hire Date
Nancy Davolio Sales Representative Ms. 12/8/1978 5/1/2005
Andrew Fuller Vice President, Sales Dr. 2/19/1965 8/14/1992
Janet Leverling Sales Representative Ms. 8/30/1985 4/1/2002
Margaret Peacock Sales Representative Mrs. 9/19/1973 5/3/1993
Steven Buchanan Sales Manager Mr. 3/4/1955 10/17/1993
Michael Suyama Sales Representative Mr. 7/2/1981 10/17/1999
Robert King Sales Representative Mr. 5/29/1960 1/2/1994
Laura Callahan Inside Sales Coordinator Ms. 1/9/1985 3/5/2004
Anne Dodsworth Sales Representative Ms. 1/27/1980 11/15/2004

Our Blazor Grid uses the standard DataAnnotationsValidator to validate user input (based on data annotation attributes defined in an edit model). The Grid validates editor values once a user moves focus away from data editors or uses a command that saves changes. In EditCell mode, the grid control validates user input when focus moves away from the edited row. The control prevents users from editing a different row until they address all validation errors.

Once validation is completed, the component marks editors with colored outlines and displays validation icons: green for valid values, and red for invalid values. Hover the mouse pointer over an error icon to display the corresponding error message within the tooltip.

You can implement your custom validator components and declare them in the CustomValidators template. To disable input validation, set the ValidationEnabled option to false.

Note: You should not rely on form validation alone to secure your Blazor-powered app. Form validation is only designed to improve application usability. A threat actor can bypass validation and send malicious data to the server. To minimize security related threats/risks, you must track data changes using multiple strategies. Refer to the following topic for more information: Validate User Input.