Does anyone have a LiveCycle form count up timer example they can share? The timer needs to have a start and stop buton and a reset/clear button.
I have seen an example in an Acrobat form but do not know how to create one in LiveCycle.
Thank you
Solved! Go to Solution.
Assume the counting field TextField1 with a default value of 0 is in subform Main,
For the start button:
global.t = app.setInterval("xfa.form.form1.Main.TextField1.rawValue=parseInt(xfa.form.form1.Main.TextField1.rawValue)+1;",1000);
For the stop button:
app.clearInterval(global.t);
For the reset button:
TextField1.rawValue=0;
Kyle
Views
Replies
Total Likes
Assume the counting field TextField1 with a default value of 0 is in subform Main,
For the start button:
global.t = app.setInterval("xfa.form.form1.Main.TextField1.rawValue=parseInt(xfa.form.form1.Main.TextField1.rawValue)+1;",1000);
For the stop button:
app.clearInterval(global.t);
For the reset button:
TextField1.rawValue=0;
Kyle
Views
Replies
Total Likes
Kyle,
First of all - thanks so much for replying to my request. I really appreciate your help!
I created the timer as you directed but when testing it in the LiveCycle preview mode, the timer keeps stopping at various amounts of time (usually in less than 10 seconds) However, when opening the form outside of LiveCycle, it appears to work correctly. Any idea why it stops working in LiveCycle preview? (form is linked below).
Also: When the timer is stopped, I would like to convert the total elapsed time to HH:MM:SS - maybe in a different TextField "window" - is there a way to do this?
https://workspaces.acrobat.com/?d=ksoCJwbwUmCSJZmLe-P09g
Thanks again so very much for your help with this.
~Don
Views
Replies
Total Likes
I'm not sure why that happens in the preview. Does it stop completely? I've had experience where the preview doesn't work and the stand alone app does and in most cases I'm just happy it works in the standalone and leave it at that.
For the time format put the following code in the calculate event (or whatever event you want) of the TextField you want to see it formatted, where TextField1 is the field showing the total amount of seconds:
var
a = TextField1.rawValue;seconds = a % 60;a /= 60;
minutes = Math.floor(a % 60);
a /= 60;
hours = Math.floor(a % 24);
this.rawValue=hours+":"+(String(minutes).length==1 ? "0":"")+minutes+":"+(String(seconds).length==1 ? "0":"")+seconds;
I'm sure there's probably a FormCalc trick or display pattern out there that mitigates the need for all that code but this works too.
Kyle
Kyle,
Yes, it stops completely but seems to work great outside of LiveCycle. The formatting for the display works great too! Thanks again so very much.
~Don
Views
Replies
Total Likes
A couple timer problems I've noticed:
Note: Opening dropdown list objects on the form do not stop the timer.
Is there any way to fix these? I tried changing the security settings did not help.
Thanks,
~Don
Views
Replies
Total Likes
I doubt there's any way to fix that.
Kyle
Views
Replies
Total Likes
Okay, thanks Kyle. It works great!
-Don
Views
Replies
Total Likes
Can you please explain more since I am receiving error while applying for this, I have been searching for months after this code to set my timer and work nicely as clock , is there video or anything that can you provide me please
Views
Replies
Total Likes
Sorry, I no longer have that script or the form.
Views
Replies
Total Likes
Hi dear,
can you send me your form example I really appreciate it I can use your timer for my form , please it will be a great help to me please
send to my email
Views
Replies
Total Likes
Sorry, like I wrote prior, I no longer have the form or the script. That was 4 years ago!
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies