Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Warning Pop up message based on date calculation/validation?

New Here ,
Oct 04, 2018 Oct 04, 2018

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
941
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Oct 04, 2018 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);

    }  

}

Translate
Community Expert ,
Oct 04, 2018 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);

    }  

}

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

Perfect, thanks so much!

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