function CheckDates() {
var ExtendToDate = GetFieldValue("Extend to Date");
var LastLeaverDate = GetFieldValue("ARP Mandatory Exit Date");
var difference = moment.duration(moment(LastLeaverDate, 'MM-DD-YYYY') -
moment(ExtendToDate, 'MM-DD-YYYY')).asDays();
if(difference < 30) {
alert("This persons will have to leave within 30 days of the proposed extension");
}
}
function CheckDates_WithDelay() {
// Delay 1000 milliseconds before starting CheckDates
setTimeout("CheckDates()",1500);
}
AddChangeCallback("ARP_MANDATORY_EXIT_DATE", CheckDates_WithDelay);
AddChangeCallback("EXTEND_TO_DATE", CheckDates_WithDelay);
在表单上,用户可以更改扩展至日期和 ARP 退出日期。这就是为什么我添加了更改回调和延迟。我已经测试了很多次,但我没有收到任何警报...
感谢你的帮助。