How can I make the form first name input field not accept empty strings with space characters " "
<form asp-action="SaveRegistration" autocomplete="off">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group">
<label asp-for="FirstName" class="control-label"></label>
<input asp-for="FirstName" class="form-control" />
<span asp-validation-for="FirstName" class="text-danger"></span>
</div>
Model:
public class ContactInfo
{
[Required(ErrorMessage = "This field is required")]
[StringLength(50)]
[DisplayName("First name")]
public string FirstName { get; set; }
}
With [Required]
attribute the user can still submit with a string with just space characters " "
I know it's a simple question, but I am novice in ASP.NET MVC