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

Date Entry Issue

uschad
Registered: Mar 3 2010
Posts: 19
Answered

have never been able to get this issue to work satisfactory. Any help would be great. I need a date field in the MM/DD/YYYY format that will automatically fill our and enter the slashes when the user enters information. For instance if they enter 6291978 the script will automatically enter it as 06/29/1978. I need it to read and enter any leading zeros and to automatically enter the slashes. thanks in advance.

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Well,

this isn't a trivial topic because there are to many possible ifs, ands and buts.
You cannot know what your users really type into the field.
So, you will have to design a script that is very tolerant to input values.
This example will work for inputs like in your description 6291978 or 06291978.
It also removes all eventually entered spaces and only works if the user enters 7 or 8 digits.

  1. var Input = $
  2. if(Input eq "") then
  3. $ = null
  4. else
  5. Input = Ltrim(Rtrim(Input))
  6. if(Len(Input) >= 7 and Len(Input) <= 8) then
  7. var GetYear = Right(Input, 4)
  8. var GetMonth = Right(Replace(Input, GetYear, ""),2)
  9. var GetDay = Replace(Input, Concat(GetMonth, GetYear), "")
  10.  
  11. if(Len(GetDay) < 2) then
  12. GetDay = Concat("0", GetDay)
  13. endif
  14. $ = Concat(GetDay, "/", GetMonth, "/", GetYear)
  15. endif
  16. endif

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

uschad
Registered: Mar 3 2010
Posts: 19
That seemed to do the trick. Thanks very much for the help.