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

Year validation only Livecycle 8.0

dol303
Registered: Mar 26 2008
Posts: 8

Hello,
I am a newbie to designer and am trying to create a form field whereby a user will have to input the 4 digit year in a text field. the range of years would be from two years ago to the present (ex. from 2006 to 2008).

Initially I tried using the date/time field but couldn't find a way to exclude the month, date and popup calendar. Then I tried some javascript code in the validation event and at did not work.

What is the best way to approach my problem. If you are using a text field to input numerical values does the validation occur in the validation event or the enter event. Also what code should I use to make it work. Thanks.

My Product Information:
LiveCycle Designer, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
Have you tired to make the date time field a date field only and enter just the year format chatacters into the display format?

Or one can use FormCalc's "Date2Nm()" and "Num2Date()" functions to reformat the date stirng to just the 4 digit year?

// get the number of days from DateField with the format "MMM DD, YYYY"
var DateNum = Date2Num(DateField.formattedValue, "MMM DD, YYYY")
// Use the format to extract the 4 digit year
var YearOnly = Num2Date(DateNum, "YYYY")

George Kaiser