如何限制用戶輸入未來日期?jquery datepicker驗證
這是視圖:
@Html.TextBoxFor(a => a.ARRIVING_DT,new { @class="date"})
$(".date").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd/mm/yy' ,
selectOtherMonths: true,
showOtherMonths: true,
showStatus: true,
showButtonPanel: true,
showOn: 'button',
buttonImage: '../../Content/themes/base/images/i_cal.gif',
buttonImageOnly: true,
buttonText: 'Choose a Date'
});
我試圖寫valdation屬性此爲:
[Required(ErrorMessage = "Enter Date of Departure")]
public object DEPARTURE_DT { get; set; }
還有什麼需要被writen? Range屬性也不起作用。感謝您的幫助。
你嘗試過使用的minDate和/或的maxDate? maxDate:0可能會訣竅。 http://jqueryui.com/demos/datepicker/#min-max – SpaceBison
[檢查這個答案] [1] [1]:http://stackoverflow.com/questions/4002781/jquery-ui日期選擇器未來日期 –