0
Button that enters random number (between 1 and 21) in 100 diff fields
New Here
,
/t5/acrobat-discussions/button-that-enters-random-number-between-1-and-21-in-100-diff-fields/td-p/10945219
Feb 24, 2020
Feb 24, 2020
Copy link to clipboard
Copied
I can't work this one out.
See image... I have 100 fields that i need a script on a button to enter a random number from 1 to 20 in them. The red button already clears them.
Any advice?
TOPICS
PDF forms
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/acrobat-discussions/button-that-enters-random-number-between-1-and-21-in-100-diff-fields/m-p/10945470#M242318
Feb 25, 2020
Feb 25, 2020
Copy link to clipboard
Copied
What are those fields called?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Savourn
AUTHOR
New Here
,
/t5/acrobat-discussions/button-that-enters-random-number-between-1-and-21-in-100-diff-fields/m-p/10945554#M242319
Feb 25, 2020
Feb 25, 2020
Copy link to clipboard
Copied
currently Tex01 to Tex100, but can be whatever is easiest
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/acrobat-discussions/button-that-enters-random-number-between-1-and-21-in-100-diff-fields/m-p/10945622#M242324
Feb 25, 2020
Feb 25, 2020
Copy link to clipboard
Copied
You can use this code:
for (var i=1; i<=100; i++) {
var n = Math.floor(Math.random()*21)+1;
if (n==22) n--;
if (i<10) this.getField("Tex0"+i).value = n;
else this.getField("Tex"+i).value = n;
}
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Savourn
AUTHOR
New Here
,
LATEST
/t5/acrobat-discussions/button-that-enters-random-number-between-1-and-21-in-100-diff-fields/m-p/10945668#M242328
Feb 25, 2020
Feb 25, 2020
Copy link to clipboard
Copied
You rock, ty!
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

