Reputation: 375
How to force MVC4 to stop adding 'type="" ' and 'data-val-...' attributes?
Eg.
<input type="number" data-val-number="The field Months must be a number." />
Upvotes: 2
Views: 1466
Reputation: 3505
Those are added automatically by the HTML helpers you are using.
You have three options:
1) Create your own HTML helper that doesn't add data-val
http://www.asp.net/mvc/tutorials/hands-on-labs/aspnet-mvc-4-helpers,-forms-and-validation#Exercise2
2) user jQuery to remove data-val attributes from the inputs you want
3) Simply don't use HTML helpers and create the input tag yourself
Upvotes: 1