I created an Acrobat form (Acrobat 9.3.2 Pro). In a Date field, the user enters the date they complete the form. Once the user has entered the Date field, I'd like another field on the 2nd page of the form to automatically complete with a date 3 business days from the date entered by the user.
I really know nothing about Javascript, and although this seems like it ought to be a relatively easy calculation to do, I have absolutely no clue how to go about doing it. I've done some reading from internet posts, and the only thing it's done is get me more confused.
I doubt I'll ever need to learn much Javascript programming, so I was hoping that one of you kind souls could assist in the code that would make this work.
The form was created in a PDF, not from LiveCycle.
Thanks!!!!!
Maggie
- Read the first field's value.
- Parse it to a Date object using util.scand()
- Convert it to milliseconds using the getTime() method. (the last two steps can be done using Date.parse() as well)
- Now comes the tricky part: You can add three days to the date by adding 259200000 milliseconds to it (the equivalent of 3 days), but then you still need to check whether the result is a business day or not.
Ignoring holidays, I would use the getDay() method, and if it returns 5 or 6 add another day or two to the result.
- Parse the result back to a string using util.printd() and apply it to event.value .
- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com