Offsetting Date in Second Date Field (LiveCycle)

Nate_Adam

25-04-2018

Hi, I am currently designing a form and in a particular section I have enabled the user to select the current month using a date picker (Date/Time Field) where a second Date/Time Field will automatically fill.

I have set the Data Connection to global (so they are connected), however I wish to offset the date in the second date field by nine months, where April 2018 will appear as January 2019, May 2018 as February 2019, and so on.

Please let me know how I may be able to do this.

Thanks,

Nate

Accepted Solutions (1)

Accepted Solutions (1)

_Bruce_Robertson

MVP

26-04-2018

Hi Nate,

I think you should remove the global binding and use a calculate event in the second date field, Something like this JavaScript

if (!DateField1.isNull) {

    var date = util.scand("yyyy-mm-dd", DateField1.rawValue);

    if (date != null) {

        date.setMonth(date.getMonth() + 9);

        util.printd("yyyy-mm-dd", date);

    }

}

You should just need to change the name of the first date field from the DateField1 name I have used in the above sample.

Bruce

Answers (1)

Answers (1)

Nate_Adam

26-04-2018

Hi Bruce,

Thank you for the prompt reply.

I was able to implement the above script in LiveCycle and it works exactly as required.

I greatly appreciate your help and once again, thank you.

Regards,

Nate