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

Auto populating Acro Form field with curr date in format dd/mm/yyyy

pramod_kmr73
Registered: Mar 11 2008
Posts: 25

I am trying few things in the from i am designign using Acrobat From.

a) i need to populate a date filed with the current date in the format 'dd/mm/yyyy' only if the user simply tabs the field without filling any date . i.e the field should take current date automatically if the user move ahead without filling the field.

b) i need to populate another field based on the value of the above filed in the format 'yyyymmdd' . This should be automated populated using the values populated in the filed above .

regards

pramod
mumbai, India.

My Product Information:
Acrobat Pro 8.1.2, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
Have you checked the JavaScript API documentation?

[url=http://www.adobe.com/devnet/acrobat/javascript.php]JavaScript for Acrobat[/url]

The following code placed in the "On Blur" action will put the current date in the format requested when no date has been placed in the field:

if(event.value =="")
this.getField(event.target.name).value = util.printd("dd/mmm/yyyy", new Date())

George Kaiser

scotl578
Registered: Jun 6 2011
Posts: 5
what would be the code for the additional fields?
scotl578
Registered: Jun 6 2011
Posts: 5
Is there a way to have the other date fields be blank before a user enters a date in the other date fields?
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
You will need to change the field name as needed for other fields.

Yes, you can reset the other fields as described in the Acrobat JS API Reference.

George Kaiser