How to get today's date and abort submission if it exceeds 3months?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2024 01:15 AM
Hello,
I have a requirement for aborting the form submission, if the date field value entered is more than 3 months.
How do I implement this using client script?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2024 01:23 AM
Hi @Kushi you can create a onSubmit client script:
Example:
var selectedDateNum = getDateFromFormat(newValue, g_user_date_format); //This gives the selected date
var ninety_days =129600; //90 days in minutes
var ninety_days_date = new Date(new Date().getTime() - ninety_days*60000);
var ninety_days_dateStr = formatDate(ninety_days_date, g_user_date_format);
var ninety_days_dateNum = getDateFromFormat(ninety_days_dateStr, g_user_date_format);
if(selectedDateNum < ninety_days_dateNum) {
alert("Selected date cannot be less than 90 days");
return false; //abort submission
}
Harish