:: Forum >>

Setting An AW.UI.Combo's Value

So, I instantiate a combo box using:

var versionCombo = new AW.UI.HTMLStripCombo();

How does one set the combo to a value in the array of values, in this case vers_val[]?

The line in bold is incorrect, since it seems to do nothing. Using setControlText() just sets the displayed text and not the control's value.

- alphadog
Paul Tiseo
Tuesday, November 21, 2006
My bad. I guess nested styling tags don't work in this discussion forum.
Paul Tiseo
Tuesday, November 21, 2006
Just use an aditional setItemValue(array)
Posted by Javier on Thursday, March 9, 2006

And in your case could be resumed as follows:

set values
versionCombo.setItemValue(["id", "name", "date"]);
set Texts
versionCombo.setItemText(["Number", "Account", "Operation Date"]);
set Selection:
versionCombo.setSelectedItems([1]); /// note the brackets
and to know the selected value, use
var selected_value = versionCombo.getItemValue(versionCombo.getSelectedItems());
Tuesday, November 21, 2006

Carlos, thanks, but it's not working. I'm using:


and the combo's text box remains empty. No error, though. And the value is in fact set, just not displayed. IOW, the call to getItemValue() returns the right option from the drop-down, but the display hasn't been adjusted.

- alphadog
Paul Tiseo
Wednesday, November 22, 2006

Don't know if there is a better way, but here's one option:

Paul Tiseo
Wednesday, November 22, 2006
Forgot to add, the call to setControlText() should come after the call to setSelectedItems(), for obvious reasons.
Paul Tiseo
Wednesday, November 22, 2006

This topic is archived.

Back to support forum

Forum search