Link to home
Start Free TrialLog in
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);")
Avatar of donnie91910
donnie91910

ASKER

The problem that i am having is that the "Tomorrow" field is not populating.
Avatar of leakim971
do you get the Today value populated from your code?
yes. The "Today" field does get populated.
Hi,

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

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
leakim971 - the modified version of my code worked perfect.
good to hear!