Copy link to clipboard
Copied
Hello
I've created a form which will be uploaded to our intranet, the form has a field which automatically generates a random number when the form is opened, that works well but, the number changes when the file is saved or opened.
Initially the code was in the document processing so ran when the form was opened, I've now deleted that and added the code to the field itself but it's still changing if the user goes into the field.
This is the code I've used
this.getField("RefNo").value = util.printf("%06d", Math.floor((Math.random() * 1000000) + 1));
It's set on a mouse up action and the locked option is also selected.
I want the number to generate when the form is opened and then lock so it doesn't change when opened again, can this be done?
I'm used Adobe Acrobat Pro 9.
Any help would be appreciated.
Move it back to where it was. Just add this line before it:
if (this.getField("RefNo").valueAsString=="")
Copy link to clipboard
Copied
Move it back to where it was. Just add this line before it:
if (this.getField("RefNo").valueAsString=="")
Copy link to clipboard
Copied
Thank you so much,that was a super fast response and works perfectly. You are a star
Copy link to clipboard
Copied
Hi.
You should be aware that all PDFs embed an unique "Permanent identification number" that you can use instead of creating anoter one:
http://abracadabrapdf.net/utilities-in-english/abracadabra-doc-id_en/