codetoad.com
Home||ASP|ASP.Net|C++/C#|DHTML|HTML|Java|Javascript|Perl|VB|XML||CodeToadPlus!||Forums||RAM
Search Site:
Search Forums:
date of birth validation using java script-very urgent abcdef at 06:01 on Friday, April 27, 2007

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.

Re: date of birth validation using java script-very urgent manimaran.vg at 04:56 on Saturday, February 06, 2010

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>








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
matrix addition
Re: Storing data from HTML to Excel or TXT
Re: function within loop problem
Re: Ô‡´ò¥¯¥é¥Ö¤Ï ¥Æ©`¥é©`¥á¥¤¥É£ò£±£±¥¢¥¤¥¢¥ó ¤Î£··¬ ¤Ç¤¹
Re: Replace
Re: タイトリスト AP2アイアン 712�情�
Re: SMS from Perl using HTTP request
Re: Charl Schwartzel
Re: Adhyayan - Annual Student Conference and Online Coding Festival


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


Copyright codetoad.com 2001-2013