Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Script Object problem

Avatar

Not applicable
Here is the code from a script object called BulkScript.



var myItemNum = new Array(

null,

3611,

3518,

3509,

3521

);



var myProducts = new Array(

"",

"Apple slices",

"Black beans",

"Pinto beans",

"White beans"

);



var myPoundsPerBag = new Array(

null,

15,

25,

25,

25

);



var myPricePerPound = new Array(

null,

3.31,

.59,

.48,

.47

);



var myPricePerBag = new Array(

null,

49.65,

14.75,

12,

11.75

);



function populateProduct(dropDownField)

{

var i;

for (i=0; i < myProducts.length; i++)

dropDownField.addItem(myProducts[i]);

}



function otherInfo(Product, ItemNum, PoundsBag, PricePound, PriceBag)

{

var i;

for (i=0; i < myProducts.length; i++)

{

if (myProducts[i] == Product)

{

ItemNum.rawValue = myItemNum[i];

PoundsBag.rawValue = myPoundsPerBag[i];

PricePound.rawValue = myPricePerPound[i];

PriceBag.rawValue = myPricePerBag[i];

}

}

}



The script object works in every aspect but only when I choose the first product from the Products drop down which is Apple slices. When I choose any of the other products all of the fields are populated with the right info except for the item number which is left blank. It is only when I choose Apple slices that the ItemNumber shows anything.



The order of the fields in the form is: Item number, Product, Pounds per bag, Price per pound, Price per bag.
1 Reply

Avatar

Not applicable
Oh boy. I found out the problem which is no problem with the script. There was a test script in the ItemNumber field that I forgot to remove. It works just fine.