|
| Filling today's date on document open (Acrobat 8) |
 |
Thu, 15 May 2008 06:57:38 -070 |
I'm experienced in JavaScript but new to Acrobat JavaScript.
I want to fill in a text field with today's date on document open. I've tried
two methods:
1 - Adding a document function... How do I call it on doc open?
function documentStart() {
var sDate = util.printd("mm/dd/yyyy", new Date());
this.getField("Today").value = sDate;
}
2 - Add a custom calculation script to the text field. This seems to update the
field but only when printed, not when the document opens.
|
| Post Reply
|
| Re: Filling today's date on document open (Acrobat 8) |
 |
Thu, 15 May 2008 07:22:15 -070 |
|
| Post Reply
|
| Re: Filling today's date on document open (Acrobat 8) |
 |
Thu, 15 May 2008 08:08:23 -070 |
And I thought the function needed to be bound to something or other.
Making it harder than it needs to be, one day at a time.
|
| Post Reply
|
| Re: Filling today's date on document open (Acrobat 8) |
 |
Thu, 15 May 2008 08:17:52 -070 |
Only if you want it to be a callable function. Think of it as JavaScript on a
webpage. If you declare it as a function it will not run until that function is
called. But if you just put some JavaScript calls inside script tags, that will
run as soon as it's loaded. Same here. Just include the script outside a
function at the document-level and it will run once the document is loaded.
Making it harder than it needs to be, one day at a time.
|
| Post Reply
|
| Re: Filling today's date on document open (Acrobat 8) |
 |
Thu, 15 May 2008 08:26:02 -070 |
My statement about making it harder was a reference to my making what should
have been obvious more difficult than it needed to be.
|
| Post Reply
|
|
|
|
|
|
|
|
|
|