Avatar of donnie91910
donnie91910
 asked on

JavaScript code in PDF

I have a PDF with two text fields on it "Today" and "Tomorrow".  I am trying to have the form read the "Today" field and then display "Today" + 1 day in the "Tomorrow" field.  So, if the "Today" text field is 2/18/2020 then the "Tomorrow" text field will read 2/20/2020.  Here is the code I have so far:
this.addScript("init", "var d = new Date(); var f = this.getField(\"Today\"); if (f.value==\"\") f.value = d; var t = this.getField(\"Tomorrow\"); t.value = t.setDate(d+1);")
PDFJavaScript

Avatar of undefined
Last Comment
leakim971

8/22/2022 - Mon
donnie91910

ASKER
The problem that i am having is that the "Tomorrow" field is not populating.
leakim971

do you get the Today value populated from your code?
donnie91910

ASKER
yes. The "Today" field does get populated.
Your help has saved me hundreds of hours of internet surfing.
fblack61
lenamtl

Hi,

Usually Javascript won't play well into PDF or not at all .
What do you use to generate the PDF?
ASKER CERTIFIED SOLUTION
leakim971

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
donnie91910

ASKER
leakim971 - the modified version of my code worked perfect.
leakim971

good to hear!
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.