Expand my Community achievements bar.

Auto Populate Date Fields by One Day

Avatar

Level 7

I have a form with 7 Date Fields.

Is it possible if a user select a date in the first one then

auto populate the rest of the date fields by one Day.

For example if the first Date Field is December 15, 2011 then

second Date Field will be: December 16, 2011

Third Date Field: December 17, 2011

and so on....

THANK YOU

2 Replies

Avatar

Level 4

Hi,

Yes, this is possible by writing the following script in the "exit" event of the "Date1" field in "FormCalc" as below

Date2.rawValue = Num2date(Date2Num(Date1.formattedValue, "MMM DD, YYYY") +1, "MMM DD, YYYY")

Date3.rawValue = Num2date(Date2Num(Date1.formattedValue, "MMM DD, YYYY") +2, "MMM DD, YYYY")

Date4.rawValue = Num2date(Date2Num(Date1.formattedValue, "MMM DD, YYYY") +3, "MMM DD, YYYY")

Date5.rawValue = Num2date(Date2Num(Date1.formattedValue, "MMM DD, YYYY") +4, "MMM DD, YYYY")

Date6.rawValue = Num2date(Date2Num(Date1.formattedValue, "MMM DD, YYYY") +5, "MMM DD, YYYY")

Date7.rawValue = Num2date(Date2Num(Date1.formattedValue, "MMM DD, YYYY") +6, "MMM DD, YYYY")


Thanks,

Dev.

Avatar

Level 7

Hi Dev

Thank you your script works fine!

The date pattern I am using for fields Date.2-7 is "EEEE,DD MMMM, YYYY"

Is it possible the pattern ONLY for date field Date1 to be: date{DD MMMM,YYYY}?

when I try to use this as Display pattern, populated dates are not correct!

Thank you