I need to do a date validation to ensure date entered is between a start and end date field values. Can you please advise how I can do that? The following code works on false but does not save if true. Also I need to allow for blank fields as well.
function dffs_PreSaveAction(){
var startDate = spjs.utility.getDateFieldAsDateObject(‘StartDate’);
var endDate = spjs.utility.getDateFieldAsDateObject(‘EndDate’);
var dateAnswer1 = spjs.utility.getDateFieldAsDateObject(‘DateAnswer1’);
if (dateAnswer1 < startDate || dateAnswer1 > endDate) {
alert(‘DateAnswer1 must be greater than StartDate and less than EndDate’);
return false; // Return false to indicate validation failure
}
return true; // Return true to indicate validation success
}