Copy link to clipboard
Copied
Hi,
I tried to modify some other script I found, but I really don't understand it well enough to make it work. I am using Adobe Acrobat XI Pro.
I am calculating the expiration date of an extended warranty. All dates are entered with the MM DD and YYYY in separate fields, due to the Manufacturer's form.
First Date is manually entered, date of original purchase.
2nd date is already set up to autofill current date.
3rd date is where I need help. I have the MM and the DD as duplicate fields from the first date, this is working fine. I need the "Year_3" field to automatically add 4 years to the YYYY from from the first date's "Year" field.
Any help is appreciated.
If the first field is called Year1, use this custom calculation code for the second field:
var year1 = this.getField("Year1").valueAsString;
if (year1=="") event.value = "";
else event.value = Number(year1)+4;
Copy link to clipboard
Copied
If the first field is called Year1, use this custom calculation code for the second field:
var year1 = this.getField("Year1").valueAsString;
if (year1=="") event.value = "";
else event.value = Number(year1)+4;
Copy link to clipboard
Copied
Is there something similar to this? Where field one is set up to manually enter a date and then a series of fields auto fill? Field one = 8/7/2019 and then field two auto fills 8/8/2019, field three auto fills 8/9/2019, and so forth. Then if someone came and changed field one to another date, all other fields will adjust?
Copy link to clipboard
Copied
I found this that seems to work:
var date=new Date(this.getField("today").value);
date.setDate(date.getDate()-1);
event.value=util.printd("mm/dd/yyyy", date);
Only this is when I remove the "original date" I entered, the other cells don't clear out. Is there a way to do that?