$(document).ready(function() {
//Create date date validator
var futuredatevalidation = document.createElement('span');
//setup validator property and associated field
futuredatevalidation.style.display = "none";
futuredatevalidation.id = "dr_futuredatevalidation";
futuredatevalidation.controltovalidate = "dr_date"; //datetime field
futuredatevalidation.evaluationfunction = function() {
var returnValue = true; //set default value as true
//get date done
var date = $("#dr_date").val();
//check if date is missing
if (date == "101")
returnValue = false; //if date is blank return false
//format date using moment
date = moment(new Date(date), 'DD/MM/YYYY');
//current date
var currentDate = new Date();
currentdate = moment(new Date(currentDate), 'DD/MM/YYYY');
//get day from date
//var daynumber = new Date( date).getDay();
//validation for saturday and sunday
if (date < currentdate ) {
//setup custom validation message
this.errormessage = "<a href='#dr_dateoftheprocedure_label'> Date should be greaterthan Current Date.</a>";
returnValue = false;
}
return returnValue;
};
// Add the validator to the page validators array:
Page_Validators.push(futuredatevalidation);
// Wire up the click event handler of the validation summary link
$("a[href='#dr_date_label']").on("click", function() {
scrollToAndFocus('dr_date_label', 'dr_date');
});
});