Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Time Spent in Form

jnicholas330
Level 7
Level 7

I would like to track the following: a timestamp when the user first opens a form, and the total time spent filling out a form. Is it possible to collect this information?

1 Accepted Solution
dcidev
Correct answer by
Level 8
Level 8

You could store the time when the user opens the form and store it again when the user saves the form and show the difference.

Here's how you can do it:

1) Create a hidden field called startTime and put this JavaScript in the docReady event of the field:

this.rawValue=(new Date()).getTime();

2) Create another hidden field called endTime and put the following JavaScript in the preSave event of the field:

this.rawValue=(new Date()).getTime();

var dif = this.rawValue-startTime.rawValue;

var d = new Date(dif);

totalTime.rawValue="Hours: "+d.getUTCHours()+" Minutes:"+d.getMinutes()+" Seconds:"+d.getSeconds();

3) Create a third field called totalTime.

Kyle

View solution in original post

1 Reply
dcidev
Correct answer by
Level 8
Level 8

You could store the time when the user opens the form and store it again when the user saves the form and show the difference.

Here's how you can do it:

1) Create a hidden field called startTime and put this JavaScript in the docReady event of the field:

this.rawValue=(new Date()).getTime();

2) Create another hidden field called endTime and put the following JavaScript in the preSave event of the field:

this.rawValue=(new Date()).getTime();

var dif = this.rawValue-startTime.rawValue;

var d = new Date(dif);

totalTime.rawValue="Hours: "+d.getUTCHours()+" Minutes:"+d.getMinutes()+" Seconds:"+d.getSeconds();

3) Create a third field called totalTime.

Kyle

View solution in original post