I have an ASP.NET MVC4 project with HTML5 semantic markup enabled. When used, the @Html.EditorFor(m => m.MyDateTimeField)output is input c type="datetime". I want to stop EditorForcreating HTML5 markup. How can i do this?
This is currently an issue only in Opera, because other browsers (as far as I know) do not support type="datetime". I have jQuery datepicker in the field, so in Opera I get both jQuery datepicker and datepicker operator.
I can fix using any of:
a. Use js to change input type
b. Use Html.TextBoxFor(m => m.MyDateTimeField)
with. Using a custom editor template
e. Use modernizr to determine if datetime is supported, and if so, do not use jQuery datapicker
The solution I want is to disable HTML5's generation HtmlHelper.EditorFor. I want it to HtmlHelper.EditorForfunction in the same way as if I hadn't checked the "html5 semandtic markup" flag when creating the project.
EDIT:
After a bit more searching, I came across with DataTypeAttributewhich I can apply to my model fields to make them appear as input type="text"rather than html5 matching. This is a potential fix, but less than ideal. Surely there must be a switch somewhere to disable html5 in EditorFor(and equivalent helpers)?
A bit more information:
I have two projects. The first was created using "Html5 semantic markup," and the other without it. The first uses the html5 input types when used EditorFor, the second does not. I need to stop the first project EditorFor, which behaves as if without deletion EditorFor. Should there be a setting somewhere?