テキストボックスに ajax カレンダーを適用し、その選択に次のチェックを適用しました
function checkDate(sender, args) {
if (sender._selectedDate > new Date()) {
alert("You cannot select a day future than today!");
sender._selectedDate = new Date();
// set the date back to the current date
sender._textbox.set_Value(sender._selectedDate.format(sender._format))
}
}
私のhtmlコードは次のとおりです。
<asp:TextBox ID="txtDOB" Width="140px" MaxLength="50" runat="server"></asp:TextBox>
<ajaxctrl:calendarextender onclientdateselectionchanged="checkDate" id="cale_txtDOB"
runat="server" targetcontrolid="txtDOB" format="MM/dd/yyyy" cssclass="cal_Theme1">
</ajaxctrl:calendarextender>
正常に機能していますが、日付を手動で入力すると機能しません。どうすれば両方の方法を機能させることができますか。
ユーザーが手動で入力すると日付もチェックされ、ユーザーがカレンダーから選択すると日付も検証されます。