Matching the default value to combo option

Hello, I have another question related to populating the values of the combo on combo initiation:

I have several combos initiated as a filter in one form, and I preset the default values like this:


var myDefValue=document.getElementById(myid).value;
z.loadXML(mycomboUrl, function() {
z.setComboText(myDefValue);

});

Currently this default value is forced into a combo, and thus is treated as a new value. Is it possible to find the matching existing entry in the combo options and find it’s index, and preset the combo with this existing value?

Thank you!
Anya

Hi,

you can use getOptionByLabel method to get an option object:

var option = z.getOptionByLabel(myDefValue); if(option){ var value = option.value; z.setComboValue(value); }

Thank you Alexandra - that works great!

Anya