Quantcast
Channel: Adobe Community: Message List - PDF Forms
Viewing all articles
Browse latest Browse all 57214

Re: I need help to insert a field or a button in a form that shows me a different random number

$
0
0

I'm not the world's foremost Javascript expert, but the following may help.

Assuming you have a button and a text field. Give the text field a meaningful name, in the example below, it's called "randomNumber".

On the Actions tab of the button, enter a mouse up action with the following code:

 

function randomIntFromInterval(min,max)

{

    return Math.floor(Math.random()*(max-min+1)+min);

}

 

var rNum = this.getField("randomNumber");

rNum.value = randomIntFromInterval(1,10);

 

In this example "1" is the minimum, "10" is the maximum.


Viewing all articles
Browse latest Browse all 57214

Trending Articles