These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Date Validation: 3 Dumb Questions from a Novice

CarolinaPower
Registered: Mar 26 2009
Posts: 43

1. How can I pre-populate a field on an electronic form with the current date?

2. How can I ensure that a date given is in the future from current date?

3. How can I ensure that if a user enters Date A and Date B, that Date B is later (in the future) of Date A?

My Product Information:
Acrobat Standard 9.1, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Thom Parker has written a 3 part tutorial on date time in JavaScript:

[url=http://www.acrobatusers.com/tutorials/2006/date_time_part1]Part 1[/url] dates in JavaScript.
[url=http://www.acrobatusers.com/tutorials/2006/date_time_part2/]Part 2[/url] form fields and computations.
[url=http://www.acrobatusers.com/tutorials/working-date-and-time-acrobat-javascript-part-3-3]Part 3[/url] clocks and timers.

And [url=http://www.acrobatusers.com/tutorials/2006/document_actions]"Where is" Series, Entering Document Actions[/url] will explain where to place the code to update a field for today's date when the form is opened.

And those tutorials should provide enough to get started.

Note you need to convert the date time object to a value by using the "Number()" constrictor, "valueOF()" method or the 'getTime()" method and the value will be in milliseconds.

George Kaiser