any tool for adding a drop down calendar

I need to add a drop down calendar or a spot to auto populate the calendar. I have selected the correct date format and added the following java script

var fld = this.getField("today"); fld.value = util.printd("mm/dd/yyyy",new Date());

what am I doing wrong


ANTHONY HESTER


4 Answers

Voted Best Answer

You can download a free popup calendar here:

http://www.pdfscripting.com/public/Free-Sample-PDF-Files-with-scripts.cfm

The download is a sample file with instructions for adding it to your own file.




.
Acrobat Scripting Tutorials, Tools and Samples

All About PDF Stamps in Acrobat and Paperless Workflows - THE BOOK !!

The Acrobat JavaScript Reference, Use it Early and Often

The most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)


By Thom Parker   

This script will add today's date, not insert a drop-down calendar.

________________________________________________________________

David Dagley, CFP®
Developer at


www.PDFAutomationStation.com
________________________________________________________________

IMAGE ALT TEXT IMAGE ALT TEXT


David Dagley   

for some reason when i get out edit mode when i click on the text field in which i added the script the date will not auto populate



ANTHONY HESTER   

Following a comment…

If the code is within the field where the date should appear, the syntax has to be modified, because a field can not reference to itself via its name.

The code can be placed at two places, depending on how the field is used. If it is the result of a calculation (or part of a calculation), it would be in the Calculate event of the field, and the code would look like:

event.value = util.printd("mm/dd/yyyy", new Date() ) ;

and that's already it. Using this event means that the date will be updated every time, some value somewhere in the form gets changed (because it is part of the Calculation chain).

If the current date should appear when the user clicks in the field, you would run the following in the MouseDown event (the more logical MouseUp does not work in this case):

event.target.value = util.printd("dd/mm/yyyy", new Date() ) ;

and that's it again.

Hope this can help.

Max Wyss.

BTW, shameless plug: I happen to have developed a date picker which is very lightweight, and highly and easily configurable (and which does display the correct date for any day). If interested to license it, feel free to contact me in private (the eMail address is in my profile).


Max Wyss   


Please specify a reason: