I have built an PDF form by scanning printed document. I then edited PDF and added text field boxes using Adobe Acrobat 9 Pro to keep track of minutes of exercise for seven days per week(a text box to enter minutes on "Monday"...."Sunday"). How do I "sum" daily minutes to then calculate hours and mintues (HH:MM)to be placed in a separate text box called "Weeks Total Exercise". I will need to use AcorForms and Javascript and not Designer. I have tried several ways and have not been sucessful. Please help.
Displaying total minutes as "Hours:Minutes" requires formatting the result as a character string and not a number. The ':" is considered a string character.
Once you get the total minutes, you need to divide by 60 and truncate to get the hours. And then you can use Modulo operation to get the remainder minutes.
A custom calculation script:
// compute the total minutes or get the value from a field
var TotalMin = this.getField("Total").value;
var nHours = TotalMin / 60; // convert to hours
var iHours = parseInt(nHours); // truncate to whole hours
var nMin = TotalMin % 60; // get remainder of division (Modulo)
// define display format
var sFormat = "%,002d"; // display leading zero for hours
sFormat += ":"; // add ":" separator
sFormat += "%,002d"; // display leading zero for minutes
// display formatted result
event.value = util.printf(sFormat, nHours, nMin);
You should not use the date time display formats,as they are for formatting the date and time of an occurrence in time and not the accumulated total of time in a given set of date and time units.
George Kaiser