<source lang="javascript" collapse="true" first-line="2">
function fn_ValidateDate ( autoFill, originalPlus , strFieldName, strFieldCustom ) {
var autoDate = autoFill; var daysPassed = originalPlus; var flag ='False'; var selectedDate = document.getElementById('strCDA_29_field_0_87_Custom'strFieldCustom).value; var dateToCheck = new Date(document.getElementById('strCDA_29_field_0_87_Custom'strFieldCustom).value);
document.getElementById('strCDA_29_field_0_87'strFieldName).value = selectedDate;
var dayOfWeek =dateToCheck.getDay();
if (dayOfWeek == 6){
else{
alert("Date auto selected for "+ originalPlus +" days from today is a Saturday. This has now been changed to the following Monday");
daysPassed = daysPassed + 2; flag = 'True';
TodayPlusXDays(daysPassed);
}
else{
alert("Date auto selected for "+ originalPlus +" days from today is a Sunday. This has now been changed to the following Monday");
daysPassed = daysPassed + 1; flag = 'True';
TodayPlusXDays(daysPassed);
}
else{
alert("Date auto selected for "+ originalPlus +" days from today is a bank holiday in the Republic of Ireland. This has now been changed to the following day");
daysPassed = daysPassed + 1; flag = 'True';
TodayPlusXDays(daysPassed);
}
}
if((document.getElementById('strCDA_29_field_0_87_Custom'strFieldCustom).value != ' ') && (flag == 'False')){ var setDateOriginal = document.getElementById('strCDA_29_field_0_87_Custom'strFieldCustom).value; var Current_Date = setDateOriginal.split('/'); var newDateToPopulate = Current_Date[1] + '/' + Current_Date[0] + '/' + Current_Date[2]; document.getElementById('strCDA_29_field_0_87_Custom'strFieldCustom).value = newDateToPopulate; document.getElementById('strCDA_29_field_0_87'strFieldName).value = newDateToPopulate;
}
}
</source>