These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Validating Time for the purpose of calculation

Q-ball
Registered: Jan 25 2011
Posts: 4
Answered

I am trying to ensure that the time the user inputs is in the HH:MM format. I understand the use of the data pattern, but I want the value to be correct on exit. The problem with data pattern is it provides the message alert but allows the value to be entered. When I use my current scripting to calculate the time entered of Time1=6:00 and Time2=13:00, I get 43 hours. When I enter the time as 06:00 and 13:00 accordingly, my answer is correct as 7 hours. What formcalc or javascript scripting do I use on the exit event for the following two conditions:
1. If the user enters a morning value of X:XX, it automatically enters the zero in front: 0X:XX.
2. If the user enters time without the colon (:), it automatically enters the colon.

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Accepted Answer
Enter this patterns for the editing the time

time{H:MM}|time{H.MM}|time{H-MM}|time{H MM}

and this pattern for displaying the time

time{HH:MM}

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
You can also use the 'formattedValue' property in your scrip to get the time or date value in the display format for the field.

George Kaiser

Q-ball
Registered: Jan 25 2011
Posts: 4
Thank you. How could I use the formattedValue for the exit option?