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

Validating time string format

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

Using LiveCycle Designer 8. Radzmar provided me with the time pattern and display options which worked out well for time formats of "HH:MM" when using "H:MM" or "HH" or "HH.MM". However, if a user enters "623" without the ":" or just "6" ("HMM" or "H"), the value doesn't not correct itself (or at least respond by entering null into the field) and my script is still able to calculate the time difference (but of course wrong). The 'formattedValue' should be used, but I cannot get my validation fuction to work. For the purpose of background, I am subtracting one time from another.

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Accepted Answer
The problem is the that this is not possible.

Think of the following problem.
The user enters "123".

What does this mean? Is it 12:30 or 01.23?

That's why Designer does not allow pattern like time{HM} or time{HMM}.
You will have to add a kind of separator to the pattern, so the logic behind knows, what part of the entered value is for the hours and which for the minutes.

But you can use a little FormCalc script in the exit:Event of the field to add an extra 0 if the length is only three.
  1. if (Len($) = 3) then
  2. $ = Concat(0, $)
  3. endif

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs