Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

Random Number Generator

Explorer ,
Jun 17, 2020 Jun 17, 2020

I am using a Java Script below to randomly generate a number used for a quote number:

 

this.getField("Quote #").value = (Math.floor(Math.random()*Math.pow(10,13)));

 

It does as it should, everytime you save or close the pdf it generates a new rnadom number.  Is there a way once a copy has been saved that it saves that random number that was generated?  I am trying to use this for generating a quote number to keep on file but once it is saved and reopened it generates a new number.

 

Thanks for your help!

TOPICS
Acrobat SDK and JavaScript
3.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 17, 2020 Jun 17, 2020

Use this:

if (this.getField("Quote #").value == "")

this.getField("Quote #").value = (Math.floor(Math.random()*Math.pow(10,13)));

Translate
Community Expert ,
Jun 17, 2020 Jun 17, 2020

Use this:

if (this.getField("Quote #").value == "")

this.getField("Quote #").value = (Math.floor(Math.random()*Math.pow(10,13)));

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 17, 2020 Jun 17, 2020
LATEST

Thats exactly what I was looking for!  Thanks!!

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