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.