Skip to main content
Known Participant
October 27, 2018
Question

print date and time in two text boxes

  • October 27, 2018
  • 2 replies
  • 1763 views

I created a fillable form which I fill in part of it and then submit to others to complete it.  I need to show on the form when I printed the form and when they printed the form.  I created two text boxes and added javascript in "will print".  The problem is that when I print the form, the date and time shows up in both text boxes.  Is there a way to save my date and time, send the form to them to complete and then have the date and time they printed the form be entered on the form?  I'm really new to Java script so if you can send step by step instructions, that would be helpful.

This topic has been closed for replies.

2 replies

Known Participant
October 28, 2018

That is not working.  All I want is for when I press the print button, the date and time I printed shows up in a text box labeled "date I printed" and when they print the same document I sent them, that the date and time they printed shows up in a text box labeled "date they printed" and my date and time does not change to the date they printed. 

try67
Community Expert
Community Expert
October 28, 2018

And how is the script supposed to know if it's you or "them" who is printing the file?

Known Participant
November 3, 2018

I was hoping that since there are two text boxes, that I could possibly create scripts that would do any of the following:

1.  Both boxes will use the will print script but when I print, the date and time will be entered and frozen in that box- is there a script that will freeze the information in the box after you press print?  Then when they print, the script would know to enter the current date and time in their box only. Perhaps a script that says when you first print enter date and time in this box.  On subsequent prints enter date and time in this box only.  

2.  One box will use the will print.  The other box will use a script (not will print) to enter the date and time in the other box.

try67
Community Expert
Community Expert
October 27, 2018

Sure. Let's say the fields are called "PrintDate" and "PrintTime".

Enter this code under the document's Will Print event:

this.getField("PrintDate").value = util.printd("mm/dd/yyyy", new Date());

this.getField("PrintTime").value = util.printd("HH:MM", new Date());