Avatar

Level 2

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. This is more a personal habit to try to see if I can make it. I managed to make a commercial registration field with buttons to add and remove lines and fields hidden unless corresponding radio buttons are checked.

 

Long story short, I have this ambition of having a first form 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.

 

1. My question is how do I calculate the EndDate of 18 months minus 1 day from the StartDate. I tried using the script that works on Adobe Pro for my current forms but it doesn't work.

 

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-15 months, how do I improve the script to reflect that?

 

Many thanks in advance

Thao