So I have this in my model:
[Required]
public string PasswordLoserFullName { get; set; }
And in my @using (Html.BeginForm
I am using it like this:
<div class="form-group">
@Html.LabelFor(m => m.PasswordLoserFullName, "Name", new { @class = "control-label col-xs-2" })
<div class="col-xs-6">
@Html.TextBoxFor(m => m.PasswordLoserFullName, new { @class = "form-control"})
@Html.ValidationMessageFor(m => m.PasswordLoserFullName)
</div>
</div>
The problem is as soon as page loads, it is showing the error message. Well yes the form just loaded, nobody has typed anything. I want it to show when user have clicked the Submit button. Not as soon as the page loads.
What is it that I am doing wrong?