Autocalculate EndDate - 18 months minus 1 day from StartDate
I have already a lot of different pdf forms used to register learners as they start their apprenticeship with my company. Different programs mean different length.
Long story short, I have this idea to make the form more convenient where people feed in information like "Learner's name", "Coach", Start Date", choose the programme from the drop down list and click a button and corresponding forms are generated. I am using Adobe Livecycle. However, I got stumped on calculated date field.
1. How do I calculate the EndDate of 18 months minus 1 day from the StartDate. I tried using the script that works on Adobe Acrobat Pro for my current forms but for some reason it doesn't work in Adobe LiveCycle. I have a StartDate field for people to input the info and EndDate field is automatically calculated.
var date= util.scand("dd/mm/yyyy", this.getField("StartDate").value);
date.setMonth(date.getMonth()+18)
date.setDate(date.getDate()-1)
if (this.getField("StartDate").value!="")
{
event.value=util.printd("dd/mm/yyyy",date)
}
else
{event.value=""}
2. My second question is if I have different lengths of programs of 13-18 months, how do I improve the script to reflect that?
Many thanks in advance
Thao
