Just a quick way to validate date formatting on the web using regular expressions...
function checkDates() {
missinginfo = "";
re = /^([0-9]{1,2}\/){2}[0-9]{4}$/
if (re.test(document.ReportDates.strStartDate.value)){
}
else{
missinginfo += "\n - Start Date";
}
if (re.test(document.ReportDates.strEndDate.value)){
}
else{
missinginfo += "\n - End Date";
}
if (missinginfo != "") {
missinginfo ="______________________________________________________\n" +
"Please edit the following fields to use the xx/xx/xxxx date format:\n" +
missinginfo + "\n______________________________________________________";
alert(missinginfo);
return false;
}
else return true;
}
Show-n-tell Thursday
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment