I am displaying the datetime values in a readonly textbox(type="text") and it is rendered correctly. But when I try to save it, HTML5 highlights the textbox border which I think means that it has failed HTML5 date validation. Is it because of the format? If it is then how to change the format?. The other option, if possible, could be to disable the default html5 validation but I am curious to know its behaviour. The server side code is below:
<div class="panel-body in"> <fieldset class="scheduler-border"> <div class="form-group form-group-textarea"> <div class="col-sm-4"> @Html.LabelFor(m => m.LastUpdatedImage, new { @class = "control-label" }) </div> <div class="col-sm-8"> @Html.TextBoxFor(m => m.LastUpdatedImage, new { @class = "form-control", @readonly = "readonly" }) </div> </div> <div class="form-group form-group-textarea"> <div class="col-sm-4"> @Html.LabelFor(m => m.LastUpdated, new { @class = "control-label" }) </div> <div class="col-sm-8"> @Html.TextBoxFor(m => m.LastUpdated, new { @class = "form-control", @readonly = "readonly" }) </div> </div> <div class="form-group form-group-textarea"> <div class="col-sm-4"> @Html.LabelFor(m => m.LastPrinted, new { @class = "control-label" }) </div> <div class="col-sm-8"> @Html.TextBoxFor(m => m.LastPrinted, new { @class = "form-control", @readonly = "readonly" }) </div> </div> <div class="form-group form-group-textarea"> <div class="col-sm-4"> @Html.LabelFor(m => m.LastExported, new { @class = "control-label" }) </div> <div class="col-sm-8"> @Html.TextBoxFor(m => m.LastExported, new { @class = "form-control", @readonly = "readonly" }) </div> </div> <div class="form-group"> <div class="col-sm-12"> <input type="button" onclick="javascript:GetPropertySummaryDetails(@PropertyCode);" name="ShowSummary" id="ShowSummary" class="btn btn-primary" value="Export" /> </div> </div> </fieldset> The html which is generated for one of the textbox is:
<input class="form-control input-validation-error" data-val="true" data-val-date="The field Images Updated must be a date." data-val-required="The Images Updated field is required." id="LastUpdatedImage" name="LastUpdatedImage" readonly="readonly" type="text" value="21/05/2015 15:51:49"> The image is below: 
typeis set totext, notdatetime-local, so there is no HTML5 date validation done. (also see this post why it isn'tdatetime...)jquery.validate.unobtrusive.js? If so then you would need to usejquery.globalizeor modify the$.validator.addMethod()-refer this answer becausejquery.validateuses theMM/dd/yyyyformat for validating dates (whereas yours isdd/MM/yyyy)jquery.validate.unobtrusive.js(jquery.globalizeis just on top of that, andjquery.validate.js). The example using$.validator.addMethod()was for thejquery-ui datepicker, but you can easily modify that to parse the textbox to the correct format. However, the easiest solution is to use hidden inputs so that the controls are not validated.