When calling a function from the onSubmit event-handler of a form, if you don't want the form to submit, you must return FALSE from that function.
So, you'd want to change the following:
1) Put the "return" keyword in front of your onSubmit function call:
<form ... onSubmit="return validateTheDate()">
2) Make sure to return false when they screw up the date:
function validateTheDate() {
var dateOK = false;
var Today = new Date();
if (Response_Requested_By_Object.picked.date < Today) alert('Cannot select a date in the past.');
else if (Response_Requested_By_Object.picked.yearValue > 2020) alert('Cannot select dates beyond 2020.');
else dateOK = true;
return dateOK;
}
Bookmarks