Thursday, October 9, 2008

validate restict future days/back dates

function checkDate(s,e)
{
var strSplit = e.Value.split("/");
var month = eval(strSplit[0]);
var year = eval(strSplit[2]);
var date = eval(strSplit[1]);

var validDate= new Date(year,month-1,date);
var systemDate = new Date();

if ( systemDate > validDate)
{
e.IsValid = true;
}
else
{
e.IsValid = false;
}
}


//and then create

customer validato

change only this properties
clemt validation functionality=checkDate
controletovalidate=your txtbox name
display=dynamic
errormessage=your error message
change validation group acordingly (Recomended)

No comments: