Expand my Community achievements bar.

Livecycle - Add 1 year to a Date Field?

Avatar

Level 1

I have a form that accepts a Date (SWMSDate) in a Date Field. I want another Date field (ReviewDate) to be automatically set 1 year in the future. I have tried quite a (large) number of methods searched from the internet, and cannot get the form to do this.

I am very new to Livecycle (only attempting to learn it for this one form), and would appreciate any help.

My code in SWMSDate is:

form1.Page01.SWMSDate::calculate - (JavaScript, client)

if (this.rawValue == null)

{

    var msNow = (new Date()).getTime();

    var d1 = new Date(msNow);

    this.rawValue = util.printd("mmm/dd/yyyy",d1);

}

and in ReviewDate is

form1.Page01.ReviewDate::calculate - (JavaScript, client)

util.printd("mmm/dd/yyyy", ReviewDate.addMonth(new Date(Date.parse(SWMSDate.formattedValue)),11));

What am I doing wrong and/or not understanding?

Thanks,

RobL

0 Replies