Quantcast
Channel: Adobe Community : All Content - LiveCycle Designer
Viewing all articles
Browse latest Browse all 5571

Script to generate random integers and populate List Box

$
0
0

This is what I would like the coding to do. On a click, I want the script to generate 4 random integers between 0 and the value that the user enter the field called form1.RandomNumber.NumericField2.rawValue.  Once the random integer is generated, I then would like to store them in an array called "result".  I then would like to display the random population within a List Box called form.RandonNumber.ListBox1.  Below is the script that I wrote:

 

var result = [ ];

for (var i = 0; i != 4; ++i)

{

     var randomNumber = Math.random();

     var selectNumber = (randomNumber * form1.RandomNumber.NumericField2.rawValue) + 1;

     result.push(roundNumber);

 

     form1.RandomNumber.ListBox1.addItem(result.rawValue)

 

}

 

When the above code is executed, I basically just get the word "Empty" listed within my  List Box.

 

Any help with this would greatly be appreciated!

 

BT


Viewing all articles
Browse latest Browse all 5571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>