Expand my Community achievements bar.

LiveCycle Form - Calculating Multiple Due Dates

Avatar

Level 1

I'm attempting to add multiple due dates on a tracking form but cannot find the right scripts to do so.  Once the user enters a "Date Assigned," the form need to auto-populate various due date fields for 7, 35, 98, 119 days.  I'm new to scripting and had an old version that worked in Adobe Pro, but no longer works after transferring to Livecycle (ES2).

Old Script for each due date was similar except for the number of days.  Here's an example:

event.value = "";

var AsDateFormat = "mm/dd/yyyy";

if (this.getField("Date Assigned").value != "") {

// Obtain the value for the Date Assigned

var AsDate = this.getField("Date Assigned").value;

// convert date string to date object

var oAsDate = util.scand(AsDateFormat, AsDate);

// Establish one day variable for use in claculation

var oneDay = 24 * 60 * 60 * 1000;

// Use one day (x 35) to get 35 days to add to the Date Assigned

// get the time in milliseconds from the date object and add 7 days;

var TargetOneDate = oAsDate.getTime() + 35 * oneDay;

// convert millisecond result to date object;

var oTargetOneDate = new Date(TargetOneDate);

// set the value of the field;

event.value = util.printd(AsDateFormat, oTargetOneDate);

}

Can anyone help?

0 Replies