These days I am working hard on blazor server-side for validation.
Here are my codes:
public class ModelClass {
[Required]
public string Code { get; set; }
}
public ModelClass Model { get; set; } = new ModelClass();
private void HandleValidSubmit()
{
//
}
<EditForm Model="@Model " OnValidSubmit="HandleValidSubmit">
<DataAnnotationsValidator />
<ValidationSummary />
<InputText id="input_text" @bind-Value="Model.Code" />
<input type="submit" class="input_submit" value="Continue" />
</EditForm>
The Required attribute is used to limit the text input is not null. Now I want to limit the text input only to allow English characters and numbers.
It seems there are not any other attributes that can do it. How can I solve this? Thank you.