# Blazor Web Element & Validation ```html= InputCheckbox => <input type="checkbox"> InputDate => <input type="date"> InputNumber => <input type="number"> InputFile =><input type="file"> InputSelect => <select> InputText => <input> InputTextArea => <textarea> InputRadio<TValue> InputRadioGroup<TValue> =><input type="radio"> ``` ![](https://www.pragimtech.com/blog/contribute/article_images/1220200505011539/blazor%20validation%20attributes.png) ![](https://www.pragimtech.com/blog/contribute/article_images/1220200503224538/blazor%20form%20validation.png) ```c#= public class Employee { public int EmployeeId { get; set; } [Required] [MinLength(2)] public string FirstName { get; set; } [Required] public string LastName { get; set; } [EmailAddress] public string Email { get; set; } // Rest of the properties } ``` ![](https://www.pragimtech.com/blog/contribute/article_images/1220200503224538/blazor%20edit%20form%20validation.png) ```C#= public class Employee { [Required(ErrorMessage = "FirstName is mandatory")] [MinLength(2)] public string FirstName { get; set; } // Other properties } ``` 在ValidationMessage使用For可以直接放lambda表達式 ```html= <EditForm> <p> <label for="productionDate">Production Date: </label> <InputDate id="productionDate" @bind-Value="starship.ProductionDate" /> <ValidationMessage For="() => starship.ProductionDate" /> </p> <button type="submit">Submit</button> </EditForm> ```