Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - Javascript in PDF forms
  FAQ FAQ  Forum Search   Register Register  Login Login

Hi, welcome to the Foxit Planet PDF Forum. If you have PDF or Adobe Acrobat questions then the right place to ask them is here, in this forum.

Javascript in PDF forms

 Post Reply Post Reply
Author
Horndoggie View Drop Down
Senior Member
Senior Member
Avatar

Joined: 15 Jul 2011
Location: USA
Points: 758
Post Options Post Options   Quote Horndoggie Quote  Post ReplyReply Direct Link To This Post Topic: Javascript in PDF forms
    Posted: 29 Oct 2015 at 6:22pm
I'm sorry.  I got side tracked and never got back here.  I didn't realize you didn't know where to put it my bad.  Sorry for the confusion.
Doug
Back to Top
gkaiseril View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Location: USA
Points: 4113
Post Options Post Options   Quote gkaiseril Quote  Post ReplyReply Direct Link To This Post Posted: 29 Oct 2015 at 6:14pm

As noted the best place for this code is in the document level area so the code is only run once when the document is opened, but you will the Professional version to access this trough the UI. with standard you can use a script.

The next best place would be in  Page Open action, the code will run when the page is opened or one enters the page. You might want to add some cod so the code only runs once per open session with the PDF.

You might also want to verify that the field name in the script is exactly the same as the field's name. Spelling and capitalization must be exactly the same. 

Back to Top
BAlheit View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Points: 1114
Post Options Post Options   Quote BAlheit Quote  Post ReplyReply Direct Link To This Post Posted: 29 Oct 2015 at 3:07pm
Then you must click with the mouse into the field.

Add the code at document level.
Back to Top
oakridge92 View Drop Down
New Member
New Member
Avatar

Joined: 28 Oct 2015
Location: Cameron, NC
Points: 3
Post Options Post Options   Quote oakridge92 Quote  Post ReplyReply Direct Link To This Post Posted: 29 Oct 2015 at 11:46am
I put it into the "Actions" area with the action set as Run a JavaScript.
oakridge92
Back to Top
BAlheit View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Points: 1114
Post Options Post Options   Quote BAlheit Quote  Post ReplyReply Direct Link To This Post Posted: 29 Oct 2015 at 8:12am
Where did you add the code?
Back to Top
oakridge92 View Drop Down
New Member
New Member
Avatar

Joined: 28 Oct 2015
Location: Cameron, NC
Points: 3
Post Options Post Options   Quote oakridge92 Quote  Post ReplyReply Direct Link To This Post Posted: 28 Oct 2015 at 6:36pm
Hey Doug,
 
Thanks for the response.  I tried this too and still get nothing in the text field.  I have not done anything weird with the properties for the text box so I am not sure why it will not autofill.
 
 
oakridge92
Back to Top
Horndoggie View Drop Down
Senior Member
Senior Member
Avatar

Joined: 15 Jul 2011
Location: USA
Points: 758
Post Options Post Options   Quote Horndoggie Quote  Post ReplyReply Direct Link To This Post Posted: 28 Oct 2015 at 6:21pm

//current date

var f = this.getField("Today");
f.value = util.printd("mm/dd/yyyy", new Date());
Doug
Back to Top
oakridge92 View Drop Down
New Member
New Member
Avatar

Joined: 28 Oct 2015
Location: Cameron, NC
Points: 3
Post Options Post Options   Quote oakridge92 Quote  Post ReplyReply Direct Link To This Post Posted: 28 Oct 2015 at 5:14pm
I am very new to PDF forms and to javascript.  I got handed this responsibility for our office about 3 days ago.  I am attempting to get a date field (titled "today") in my form to be automatically filled with the current date each time the form is opened.  I have been searching for a few hours for javascript to make this work and have found 8 different scripts, tried them all, and none of them worked at all.  The text field does not autofill but I can still type into it. 
 
I am using Acrobat X Pro and also have access to LiveCycle Designer ES2.  Any help any of you can give would be greatly appreciated.
oakridge92
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.

This page was generated in 0.016 seconds.