0
C#MVCプログラムでjQuery DatePicker関数を使用していますが、「無効な日付」または今日のデフォルトの日付「17/05/2017」を示すエラーが無効です。ここでDatePickerからの無効な日付
は、同様に私のCreate.cshtmlの私のラベル/編集者としての私のjQueryの:
<div class="editor-label">
@Html.LabelFor(model => model.DateOfReading)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.DateOfReading)
@Html.ValidationMessageFor(model => model.DateOfReading)
</div>
<script>
if (datefield.type!="date"){ //if browser doesn't support input type="date", initialize date picker widget:
jQuery(function ($) { //on document.ready
$('#DateOfReading').datepicker({ dateFormat: 'dd/mm/yy', maxDate: 0, defaultDate: 0 }).val(new Date().toLocaleDateString());
})
}
</script>
は、ここに私のエンティティです:
[Required(ErrorMessage = "You must input a date")]
[Display(Name = "Date of Meter Reading")]
[DataType(DataType.Date)]
public DateTime DateOfReading { get; set; }
私がメッセージ「価値 『17/05/2017』の検針の日のために有効ではありません。」を取得それでもなお – KOD459
私は[Display(Name = "Meter Reading")の日付]は[Display(Name = "DateOfReading")]であるべきだと思います。 – tmutton
jqueryプラグインはどのような価値がありますか?可能であれば、そこにconsole.logを入れてください。 – tmutton