Autofill in of current time when filling out a textfield

New Here ,
Apr 20, 2022 Apr 20, 2022

Copy link to clipboard

Copied

Hello Adobe Support Community World,

I want to implement a PDF document in which there is a time stamp for when you fill out a specific text field with your name. I tried using the "Action" "on mouse click" using the following code but it did not work out. 

event.value = util.printd('hh:MM', new Date());

Thanks for the help

TOPICS
How to , PDF forms

Views

67

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Apr 20, 2022 Apr 20, 2022

Copy link to clipboard

Copied

Instead of event.value use event.target.value.

It may be better to use 'On focus' instead of 'Mouse UP'.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 20, 2022 Apr 20, 2022

Copy link to clipboard

Copied

LATEST

Hello there,

I manage to solve this by using the following code:

var f = this.getField("Name");
var g = this.getField("Time");

if (f.valueAsString=="") g.value = util.printd("HH:MM", new Date());

 

This code is set as run Javascript as 'action on click' when clicking on the field 'Name'.
What happens is that if the field name is empty then the time will appear in the field Time. 

Thank you for your help. 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines