Copy link to clipboard
Copied
Per the title, I'm looking for a way to automatically add the date and time to a field at the moment another field is filled in. I don't want to use stamps or signatures as i'd like to export these forms to excel in the future to log the data. Bit hard to explain but for example: User A enters initials in "IN1" field, as soon as they fill and exit the field, the date and time that the change was made is entered into a date/time field (ts1) to the right.
I know this has to be done with a javascript, and I've got one that I believe should be working but I can't figure out how to get it running. Script below:
// Declair Variables
var initials, timeStamp;
// Assign Variables
var initials = IN1
var timeStamp = ts1
if (timeStamp.value == null) {
if (initials.value != null) {
var d = Date(Date.now());
var ds = d.toString()
timestamp = ds.slice(1,24)
}
}
Thanks in advance!
Copy link to clipboard
Copied
Place the code for setting the timestamp into the Validate event script for the "Initails" field.
Something like this
this.getField("ts1").value = util.printd("dd:mm:yyyy:HH:MM:ss",new Date);
Copy link to clipboard
Copied
Place the code for setting the timestamp into the Validate event script for the "Initails" field.
Something like this
this.getField("ts1").value = util.printd("dd:mm:yyyy:HH:MM:ss",new Date);
Copy link to clipboard
Copied
That did the trick, thanks!!!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now