Hope the following JS code helps you..........
var checkDate = isCurrOrPastDate(this.rawValue)
if (checkDate == true) {
//xfa.host.messageBox("This date is valid current or past date.");
}else {
xfa.host.messageBox("Date can not be a future date");
xfa.host.setFocus(this.somExpression); //set focus back to the data field.
}
function isCurrOrPastDate(dateStr) {
var dto = dateStr;
var iLen1 = String(dto).length;
var DD = dto.substring(iLen1, iLen1 - 2);
DD = DD.replace(/^\s*|\s*$/g,"");
//xfa.host.messageBox(""+DD);
var MM = dto.substring(5,7)
var YYYY = dto.substring(0,4);
//xfa.host.messageBox(""+DD+" "+MM+" "+YYYY);
//return false;
var date1 = new Date(MM+"/"+DD+"/"+YYYY);//new Date(month+"/"+day+"/"+year);
//xfa.host.messageBox(""+date1);
var today = new Date();
var ddf = dateDifference(today,date1);
//xfa.host.messageBox("ddf: "+ddf);
if (ddf <= 0) {
//xfa.host.messageBox("This date is valid current or past date.");
return true; // date is valid
}
//xfa.host.messageBox("Date can not be a future date");
return false; // date is not valid
}
function dateDifference(strDate1,strDate2){
datDate1= Date.parse(strDate1);
datDate2= Date.parse(strDate2);
//app.alert(""+(datDate2-datDate1)/(24*60*60*1000));
return (datDate2-datDate1)/(24*60*60*1000);
}