- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â03-14-2018 08:11 AM
How can I restrict a date field from allowing to enter future date?
Thank you,
Sarah
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â03-14-2018 08:15 AM
Try this On Change Client Script for your date field that you want to check:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//current date
var currentDateObj = new Date();
var currentDateStr = formatDate(currentDateObj, g_user_date_format);
var currentDateNum = getDateFromFormat(currentDateStr, g_user_date_format);
var startDateNum = getDateFromFormat(newValue, g_user_date_format);
if (startDateNum > currentDateNum) {
alert(âDate is in the futureâ);
g_form.clearValue("your_date_field");
return false;
}
}
Regards
Paul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â03-22-2018 09:52 AM