Expand my Community achievements bar.

I don't want to allow a user to enter a date that is before January 2014

Avatar

Level 3

I don't want to allow a user to enter a date that is before January 2014. I want to restrict users from entering a date that is or prior to December 31, 2013 in a date field. Is this possible?

3 Replies

Avatar

Level 10

Hi there, depends which language you will use to do this..

FormCalc would need the use of function Date2Num();//returns number of days since 1 January 1900

JavaScript would need the use of date objects using the getTime() function//Return number of milliseconds since.... 1 January 1970

Avatar

Level 3

I would be using JavaScript. I'm not sure how the getTime() function would work.

Avatar

Level 10

Seems like it is a little more complicated just to create a new Date() object in livecycle...

the way I found to create a new Date() object is using the dateTimeEdit pattern to be 'date{EEEE, MMMM D, YYYY}'

then u can create a new Date

var date1 = new Date(DateTimeField1.editValue);

date1.getTime();

or

you can also click the following link and download the pdf from the blog...

Adobe LiveCycle Designer Cookbooks by BR001: Date handling in Livecycle Designer ES forms

using XFADate object make it easy to manipulate dates with javascript

The XFADate object created by BR001 is very good but to be able to see if a date is prior to another date you can just add this function in the object script..

you can add that function at line 200...

To use that function above you can just use this code:

if (XFADate.newDate(dateFrom).isPriorTo(DateTo)){

     //dateFrom is prior to dateTo

}

hope this help