Copy link to clipboard
Copied
I've search thru so many posts on here and found a lot of what I needed. What I can't figure out is how to add a number to calculated time field. I don't even know how to explain this.
I've attached the form. I need "Total Hours" + "Total Hours2" + "Unsupervised" = "Total Hours_3"
Total Hours - calculated time - calculates correctly
Total Hours2 - manually entered time - calculates correctly
Unsupervised - manually entered time - no calculation
Total Hours_3 - calculated time - does NOT calculate correctly
Any help would be greatly appreciated.
Hi aasher1,
See attached...you just need to change over your time format to suit, but when you press the 'RESET' button, the form fields you suggest are now cleared to allow it to be printed and filled-in by hand ;-).
Can't take the credit for the time calcs., something that is attributable to the experts on this forum - people like Try67 and Nesa. I use Try67's products extensively, can highly recommend a look at his website for some really cool solutions....http://try67.blogspot.com/
Copy link to clipboard
Copied
Time calculations are not trivial. You can start by reading these tutorials:
https://acrobatusers.com/tutorials/working-with-date-and-time-in-acrobat-javascript
https://acrobatusers.com/tutorials/working-with-date-and-time-in-acrobat-javascript-part-2
https://acrobatusers.com/tutorials/working-date-and-time-acrobat-javascript-part-3-3
Copy link to clipboard
Copied
I've seen these links on every post I looked at. They are primarily for Dates. They were no help when it comes to time.
Copy link to clipboard
Copied
Hi, If you are ok with the format you are using and just want to get correct calculation in 'Total Hours_3' field
divide 'Total Hours' with 60 in the first line of your code.
But you are not calculating time correctly, for example in 'Total Hours 2' what if you input 2.40 and 3.50 you will get
5.9 instead of 6.30 (6:30h). If you are calculating like that on purpose then ok.
Copy link to clipboard
Copied
I tried setting that the hours for Total Hours2 had to be entered with : but then it would blank out one of my other calculations.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Oh My! That's pretty much exactly what I needed. I changed the format from HH:MM to h:mm tt in the first section and it still worked. Looking at what you did for the formula's and all, I would NEVER have gotten it. Now all I need is when the form is cleared that all the total fields show as blank as the form is sometimes printed and handwritten.
Copy link to clipboard
Copied
Hi aasher1,
See attached...you just need to change over your time format to suit, but when you press the 'RESET' button, the form fields you suggest are now cleared to allow it to be printed and filled-in by hand ;-).
Can't take the credit for the time calcs., something that is attributable to the experts on this forum - people like Try67 and Nesa. I use Try67's products extensively, can highly recommend a look at his website for some really cool solutions....http://try67.blogspot.com/
Copy link to clipboard
Copied
Once again, thank you so much! I don't know what I would have done without your help. I'll check out the link you sent.