Highlighted

prepopulate dropdown using script object

ibwaheemi

01-01-2009

i have no java errors at all, my items have been prepopulated with only the first letter

in my dropdown i get

A

A

A

A

B

B

B and so on



this is my script object



form1.purchaseOrder.#variables[0].carparts - (JavaScript, client)



var carpart = new Array(new Array(243));



carpart[0] = " ";

carpart[1] = "AC Assembly Complete";

carpart[2] = "AC Compressor";

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

carpart[240] = "Windshield Washer Motor";

carpart[241] = "Wiper Motor Front";

carpart[242] = "Wiper Motor Rear";



// This function will populate the carpart Drop-down List.

// This function is called from the initialize event of the carpart Drop-down List.



function getcarpart(dropdownField)

{

dropdownField.clearItems();

for (var i=0; i < carpart.length; i++)

dropdownField.addItem(carpart[i][0]);

}



---------------------------------

in my dropdown i have this



form1.purchaseOrder.details.detail.carpart1::initialize - (JavaScript, client)



carparts.getcarpart(this);



---------------



if there is an easier way to prepolulate several identical dropdowns with the samne data i am willing to change my method



can anyone help

Replies

Highlighted

yodadobe

02-01-2009

I think it is the [0] in this line:



for (var i=0; i < carpart.length; i++) dropdownField.addItem(carpart[i][0]); }
Highlighted

Avatar

Guest

02-01-2009

As Bishop stated. You for loop for carpart is breaking the work into a character array, so you are attempting to reference the first character of the "i" array item.