Copy link to clipboard
Copied
Hi There,
Is there are possibility I can setup start date and end date to cordinate each other -- meaning, the end date should not be earlier than the start date.
Thank you.
Copy link to clipboard
Copied
Yes, you can use a custom Validation script to reject the end date if it comes before the start date.
To help with this script we'll need to know the field names and what date format pattern they use.
However, keep in mind this won't stop the user from changing the start date to a later date once the end date was selected, so you might want to clear the latter when the former is changed.
Copy link to clipboard
Copied
Hi Thank you.
For Field name it reads "TodayDate" and for date formate pattern "mm/dd/yyyy" so its 09/16/2022.
Thanks
Copy link to clipboard
Copied
Is that the name of the end date field, or the start date?
Copy link to clipboard
Copied
Hi there,
"Todaydate" is date field for start date and for end date the field is called "Lastdate"
Thank you.
Copy link to clipboard
Copied
As the custom Validation script of "Todaydate" enter the following:
this.getField("Lastdate").value = "";
As the custom Validation script of "Lastdate" enter the following:
if (event.value) {
var startDateString = this.getField("Todaydate").valueAsString;
if (startDateString=="") {
app.alert("You must first enter the start date.");
event.rc = false;
} else {
var startDate = util.scand("mm/dd/yyyy", startDateString);
var endDate = util.scand("mm/dd/yyyy", event.value);
if (endDate.getTime()<startDate.getTime()) {
app.alert("The end date must not be earlier than the start date.");
event.rc = false;
}
}
}
Copy link to clipboard
Copied
Hi there,
Just want to say thank you for this, it worked perfectly and our teams like it.
Thanks again.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more