Copy link to clipboard
Copied
Hi,
I am facing an issue with a PDF form that is used and signed by mutiple people. As per the process, once first person completes his form fields, he presses the First "Completed" button and the current date must be displayed against his name in a previously hidden field (I have programmed the button to make date field visible once button is pressed). Then the form goes to second person. When the second person completes his form fields, he presses the Second "Completed" button and the current date must be displayed against his name in a previously hidden field.
The problem I am facing is that I am able to get the current date, but when the PDF is opened on the next day, the date keeps changing to reflect new date. I don't want this and need to lock the date field once a date is populated for record. I have tried making the field readonly after the current date is populated first time, but still the date gets changed automatically the next day.
The current Custom Calculation Script used by me in a text field is:
event.target.value = util.printd("mm/dd/yyyy", new Date());
event.target.readonly = true;
Can anyone provide guidance on this?
Set the value only when the field is empty.
This is incorrect:
fld.display = fld.visible;
It should be:
fld.display = display.visible;
Copy link to clipboard
Copied
Set the value only when the field is empty.
Copy link to clipboard
Copied
Thank you Bernd for you quick reply!
Sorry to ask this, but can you please put it in a sample code for me?
Copy link to clipboard
Copied
Like this:
if (event.target.value == "") event.target.value = ...
Copy link to clipboard
Copied
Thank you!
Copy link to clipboard
Copied
Put the entire script in a mouse up action in the button field like this:
var fld=this.getField("Date");
fld.value = util.printd("mm/dd/yyyy", new Date());
fld.display = display.visible;
You could also disappear the button if it is no longer needed:
event.target.display = display.hidden;
Copy link to clipboard
Copied
This is incorrect:
fld.display = fld.visible;
It should be:
fld.display = display.visible;
Copy link to clipboard
Copied
Thank you - This was helpful!
Copy link to clipboard
Copied
Thank you so much!