Stupid Question
How can i set a default value to a combobox ? I had a hard time finding how to build it and access data in it ... and now i just want to set a default value (value + text).
Can any1 help me ? PLZ.
HD
July 5,
/********************************************************************
/////////////////////////////////////////////////////////////////////
Create combo box
/////////////////////////////////////////////////////////////////////
********************************************************************/
var obj = new AW.UI.Combo;
obj.setId("myCombo");
/********************************************************************
Size and position
********************************************************************/
// obj.setControlSize(100, 30); // width, height
// obj.setControlPosition(10, 100); // left, top - adds 'position:absolute'
/********************************************************************
Input
********************************************************************/
obj.setControlText("Some text");
obj.setControlImage("favorites");
/********************************************************************
Dropdown list
********************************************************************/
obj.setItemText(["Home", "Favorites", "Font size", "Search"]);
obj.setItemImage(["home", "favorites", "fontsize", "search"]);
obj.setItemCount(4);
document.write(obj);
Paulo Cesar Silva Reis (PC from Brazil).
July 5,
Dude, i read the basic docs lol.
That doesnt set a default value to the combobox, i need to set a Value AND a Text. Or just select the right row in the combobox.
HD
July 5,
u dont need the value, just work with the text and INDEX.
look the COMBO UI class.
AW.UI.Combo.create = function(){
AW.UI.ImageText.create.call(this);
AW.UI.Input.create.call(this);
AW.Templates.Combo.create.call(this);
var obj = this.prototype;
obj.setClass("ui", "combo");
obj.setClass("input", "");
obj.defineTemplate("popup", new AW.Templates.Frame);
obj.onCurrentItemChanged = function(i){
var text = this.getItemText(i);
this.setControlText(text);
this.hidePopup();
var e = this.getContent("box/text").element();
if (AW.safari) {
e.innerHTML = text;
}
else {
e.value = text;
e.select();
}
e = null;
};
obj.setController("selection", {
onKeyUp: "selectPreviousItem",
onKeyDown: "selectNextItem",
onItemClicked: "selectClickedItem"
});
};
Paulo Cesar Silva Reis (PC from Brazil).
July 5,
Maybe you can find an answer in this post:
javascript.forum.12308.8/v2-0-combo-control-value.html
Carlos
July 5,
oh yeah, i remember that, nice Paul.
Paulo Cesar Silva Reis (PC from Brazil).
July 5,