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

Random Number Generator

Explorer ,
Jun 17, 2020 Jun 17, 2020

Copy link to clipboard

Copied

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

Views

1.3K

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
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)));

Likes

Translate

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

Copy link to clipboard

Copied

Use this:

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

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

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
community guidelines
Explorer ,
Jun 17, 2020 Jun 17, 2020

Copy link to clipboard

Copied

LATEST

Thats exactly what I was looking for!  Thanks!!

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
community guidelines