Calculating expiry date based on document open date
Hi,
I am trying to set an expiry date for the pdf form from the day the document open for the first time. I wrote the following javascript to the page properties -
var ExpDate = new Date();
ExpDate.setDate(ExpDate.getDate()+60);
var f = this.getField("DueDate");
if (f.value == "") {
f.value=util.printd("20yy/mm/dd", ExpDate);
event.target.readonly = true;
}
var dateField = this.getField("Today");
if (dateField.value == "") {
dateField.value = util.printd("yyyy/mm/dd", new Date());
event.target.readonly = true;
}
The code picked up today's date and calculate the expiry date.
Problem: the problem is every day I open the document, it picks todays date and recalculate the expiry date. How can I fix the day the document is open for the first time so that the expiry date does not change every day? Any help is appreciated!
