hi all,

i need javascript function to validate the Date of birth field...it should check,leap year condition and also the year should nt be the future one..

Thank u...

Recommended Answers

All 2 Replies

U can also try this

/*Validate Date */
var year;
var leap = 0;
var DOB = Date;
if(IsNan(DOB == true)) 
{
  alert(“The DOB must be in the format of “DD/MM/YYYY”)
  document.frmName.txtDOB.select;
  return false;
}
/* Validation leap-year / february / day */
   if ((year % 4 == 0) || (year % 100 == 0) || (year % 400 == 0)) 
  {
      leap = 1;
   }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.