Copy link to clipboard
Copied
Hi all,
I have a form that I want the date field to be automatically populated.
I found a javascript online that inserts the date when i open the file. (https://codeshare.io/5g1lOB)
If i reopen the filled out form the next day, the date is updated.
Is there a way for the javascript to insert the date and then delete itself?
PDF form fields have a "default value" property and if properly set can be used to only fill in the date field when the form is opened. I would also set the format of the field to "None" and let the script apply the formatting for the date.
I would use the following document level script:
f = this.getField ("DATE"); if (f.value == f.defaultValue) {...
f.value = util.printd ("yyyy-mm-dd", new Date ());
This approach also allows the form to be tested and then easily set for uploading or distrib
Copy link to clipboard
Copied
Set the value of the field only when the field is empty.
Copy link to clipboard
Copied
This tuto was made for you: https://translate.google.fr/translate?sl=fr&tl=en&u=https%3A%2F%2Fwww.abracadabrapdf.net%2Fressource...
😉
Copy link to clipboard
Copied
PDF form fields have a "default value" property and if properly set can be used to only fill in the date field when the form is opened. I would also set the format of the field to "None" and let the script apply the formatting for the date.
I would use the following document level script:
f = this.getField ("DATE"); if (f.value == f.defaultValue) {
f.value = util.printd ("yyyy-mm-dd", new Date ());
This approach also allows the form to be tested and then easily set for uploading or distribution by simply resetting the form.
}