Copy link to clipboard
Copied
I need some help to see if its even possible for a message to display if I person enters a date, that is less than 2 days from today. The message would just be a read only pop up that warns the form completer that if their event is less than two days from now, they should call a specific person to arrange their reservation space. I tried some options in LiveCycle but I think LiveCycle is a little more complicated for me and the date field threw the message no matter what date was entered. So now I am using Acrobat Pro DC. And the field is currently a date field m/dd/yy format. No other validation or calculations currently set on the field.
I'm not a coder, so I may just be overthinking it or the script I'm looking for isn't a scripting thing at all but some other option I'm not aware of. I don't want it to stop the user from entering the date, but prompt them to call ahead because of short notice. (our organization has approval processes in place for these things and sometimes its can take a whole other day for the approved form to get to the meeting reservations/setup crew)
Thoughts? Help? Pretty please?
Use this code as the custom validation script of your text field:
if (event.value) {
var msPerDay = 86400000;
var today = new Date();
var d = util.scand("m/dd/yy", event.value);
if ((d.getTime()-today.getTime())<(2*msPerDay)) {
app.alert("Enter your message here.",1);
}
}
Copy link to clipboard
Copied
Use this code as the custom validation script of your text field:
if (event.value) {
var msPerDay = 86400000;
var today = new Date();
var d = util.scand("m/dd/yy", event.value);
if ((d.getTime()-today.getTime())<(2*msPerDay)) {
app.alert("Enter your message here.",1);
}
}
Copy link to clipboard
Copied
Perfect, thanks so much!