Toolbar - getItemText

I am attempting to retreive the currently selected text value on a select options.



I am using:







The onclick event fires, alerting me to the id of the element I selected, however the second alert returns an empty popup.



I am using XML to populate the list which looks like:



<?xml version="1.0"?>



    

        





        







    

        

















    





Any idea’s why this would not work? Thanks in advance for the help!!


Hello,


there is getListOptionText(parent_id,id) method that should be used in the case of select options. But it is an actual issue to get a parent id of an option.


Please, try to use the following approach as a workaround (the next toolbar version will contain a public solution for that):


webBar.attachEvent(“onClick”,function(id){
if (webBar.getType(id) == “buttonSelectNode” && webBar.getTypeExt(id) == “button”) {
pid = String(webBar.objPull[webBar.idPrefix+id][“obj”][“parentObj”][“id”]).replace(webBar.idPrefix,"");
text = webBar.getListOptionText(pid, id);
}
else text = webBar.getItemText(id);
alert(text)
});



I am looking the way to add onclick event for the selected option list. Alexandra’s code works for me directly. If you want to change the parameter to other name rather than id, please use the following code.
toolbar.attachEvent(“onClick”,function(itemId){
if (toolbar.getType(itemId) == “buttonSelectNode” && toolbar.getTypeExt(itemId) == “button”) {
pid = String(toolbar.objPull[toolbar.idPrefix+itemId][“obj”][“parentObj”][“id”]).replace(toolbar.idPrefix,"");
text = toolbar.getListOptionText(pid, itemId);
}
else text = toolbar.getItemText(itemId);
alert(text);
});