Warning Pop up message based on date calculation/validation?

New Here ,
Oct 04, 2018

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?

TOPICS
Acrobat SDK and JavaScript, Windows

Views

108

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

1 Correct Answer

Most Valuable Participant , Oct 04, 2018
try67 Most Valuable Participant , Oct 04, 2018
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);    }   }

Likes

Translate

Translate
Jump to answer Jump to answer
Most Valuable Participant ,
Oct 04, 2018

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);

    }  

}

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Davesgirl93 AUTHOR LATEST
New Here ,
Oct 04, 2018

Copy link to clipboard

Copied

Perfect, thanks so much!

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more