Highlighted

Creating a unique ID or serial number for a form

Community Beginner ,
Oct 22, 2020

Copy link to clipboard

Copied

I have a form created, but still a novice. So extended steps may need to be provided(more than likely)- just being honest since I am searching for help.

I have created a form that will be posted in one location and used by multiple people. I need to add a unique id for each as a new document is created. I do have the form set up with a "submit form" to a specific email address as a PDF, for management signature.

 

I do have a read only text field set up named: GL_ID. And I just don't know how to create it to make the magic. This unique identifier can be from 6-8 characters. I would like to attach the magic to the submit button, however it can generate the number upon opening of the document.

 

Please note that any guidance is welcome

jd

You can use this code as document level script:

this.getField("GL_ID").value = Math.floor(Math.random() * (99999999-999999) +999999);

Every time you open document it will generate random number in GL_ID field.

 

 

TOPICS
Acrobat SDK and JavaScript, Edit and convert PDFs, General troubleshooting, PDF forms

Views

71

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Creating a unique ID or serial number for a form

Community Beginner ,
Oct 22, 2020

Copy link to clipboard

Copied

I have a form created, but still a novice. So extended steps may need to be provided(more than likely)- just being honest since I am searching for help.

I have created a form that will be posted in one location and used by multiple people. I need to add a unique id for each as a new document is created. I do have the form set up with a "submit form" to a specific email address as a PDF, for management signature.

 

I do have a read only text field set up named: GL_ID. And I just don't know how to create it to make the magic. This unique identifier can be from 6-8 characters. I would like to attach the magic to the submit button, however it can generate the number upon opening of the document.

 

Please note that any guidance is welcome

jd

You can use this code as document level script:

this.getField("GL_ID").value = Math.floor(Math.random() * (99999999-999999) +999999);

Every time you open document it will generate random number in GL_ID field.

 

 

TOPICS
Acrobat SDK and JavaScript, Edit and convert PDFs, General troubleshooting, PDF forms

Views

72

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 22, 2020 0
Engaged ,
Oct 23, 2020

Copy link to clipboard

Copied

You can use this code as document level script:

this.getField("GL_ID").value = Math.floor(Math.random() * (99999999-999999) +999999);

Every time you open document it will generate random number in GL_ID field.

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 23, 2020 0
Community Beginner ,
Oct 23, 2020

Copy link to clipboard

Copied

AWESOME thanks for the response!! now here is the novice part... ummmm where do I place this. sorry and thanks in advance

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 23, 2020 0
Engaged ,
Oct 23, 2020

Copy link to clipboard

Copied

1.png2.png

You can also open document level script while in prepare form mode by pressing SHIFT+D

 

3.png4.png

After that click "Close" and thats it.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 23, 2020 0
Most Valuable Participant ,
Oct 23, 2020

Copy link to clipboard

Copied

By the way, you can make it random, easily enough, but that is not guaranteed unique. If it MUST be unique then you are going to need to store all the numbers you have given out in a central place, making this a much more complex process, needing you to pay for a server to be there 24/7 to keep the info.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 23, 2020 0
Community Beginner ,
Oct 23, 2020

Copy link to clipboard

Copied

the form will be stored on our sharepoint, but i can give up the unique for random. We run a program for free 30 minutes of leave for quality notifications. Unfortunately with telework the employee would not be able to submit the paper, so we have to have soe sort of accounting or a few bad apples will use the leave repeatedly. So basically giving the leave a "serial number" will allow the tracking.

 

Thanks in advance !!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 23, 2020 0
Adobe Community Professional ,
Oct 23, 2020

Copy link to clipboard

Copied

PDF format specs. requires an unique ID number for each PDF file, you should use it instead of reinventing the wheel 😉

https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/Acro12_MasterBook/JS_API_AcroJS/Do...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 23, 2020 0
jd981965 LATEST
Community Beginner ,
Oct 23, 2020

Copy link to clipboard

Copied

i looked at that prior to posting, and being honest, it was greek. I am a novice, compared to you guy.... but think of this, I'm a rocket scientist on this stuff to them. i just taught them how to add the signature field, but when i tried to have them add the submit button with it.... i lost them. 🙂 so i know they would not accept hunting that information, oh and those are my superiors..lol

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 23, 2020 1