I am working on a contact us form and I was able to do a successful validation but i have a small problem,
when I submit and miss one of the required values, the form comes back with the error message and does not keep the value and I have noticed that only happens if I use HTML only, it will work fine with HTML helpers.
Here is a snippet of my code:
<div class="form-group">
@Html.LabelFor(model => model.FirstName, "First Name")
<div>
<input class="form-control" name="FirstName" id="FirstName" data-val="true" type="text" value="" />
@Html.ValidationMessageFor(model => model.FirstName, "", new { @class = "text-danger" })
</div>
</div>
But it will work for the last name field:
<div class="form-group">
@Html.LabelFor(model => model.LastName, "Last Name")
<div>
@Html.EditorFor(model => model.LastName, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.LastName, "", new { @class = "text-danger" })
</div>
</div>
Filling the info:

Notice after submitting the last name stays there but the first name disappears:

Any help will be appreciated :)
valueattribute based on theModelStatevalue.data-val-requiredattribute so your not going to get client side validation so you may as well just delete yourdata-val="true"attribute - its just pointless