|
hi all,
can u please help me to validate date of birth using javascript.the date entered by the user should not be greater than today's date.help me with the code.
|
|
|
function checkDate(sender, args) {
//create a new date var and set it to the
//value of the senders selected date
var selectedDate = new Date();
selectedDate = sender._selectedDate;
//create a date var and set it's value to today
var todayDate = new Date();
var mssge = "";
if (selectedDate > todayDate) {
//set the senders selected date to today
sender._selectedDate = todayDate;
//set the textbox assigned to the cal-ex to today
sender._textbox.set_Value(sender._selectedDate.format(sender._format));
//alert the user what we just did and why
alert("Warning! - Date Cannot Greater than Toady Date");
}
}
in HTML page
<td>
<asp:TextBox ID="txtDOB" ></asp:TextBox>
<cc2:CalendarExtender ID="Calendar" TargetControlID="txtDOB" runat="server" OnClientDateSelectionChanged="checkDate">
</cc2:CalendarExtender>
</td>
|
|
|
|
|
|
|
|