Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 152999

Re: Dynamically add values to a dropdown within a table

$
0
0

Hi Jayant,

 

Maybe you can have all the subsequent dropdownlist controls copy the items from the first one,  so add this JavaScript in the preOpen event of the dropdownlist.

 

function cloneItems(sourceDropDown, targetDropDown)
{
 var values = [];
 var ids = [];
 var items = sourceDropDown.resolveNodes("#items.#text[*]");

 for (var i = 0; i < items.length; i++)
 {  var dropDownValue = items.item(i).value;  values.push(dropDownValue);  ids.push(sourceDropDown.boundItem(dropDownValue));
 }

 targetDropDown.clearItems();
 for (var i = 0; i < values.length; i++)
 {  targetDropDown.addItem(values[i], ids[i]);
 }
}
if (Row1.index > 0)
{
 cloneItems(Table1.Row1.DropDownList1, this)
}

 

Just change line 22 (the call to cloneItems, to reference the dropdown in your form)

 

Regards

 

Bruce


Viewing all articles
Browse latest Browse all 152999

Trending Articles