ZK getting selected item from combobox

combobox, java, zk

Solution

I solved it like

searchCombo.getSelectedItem().getValue().toString();

Problem

I am trying to get selected value in combobox but it returns as a ComboItem.How can I get value as string? ``` <zscript> <![CDATA[ String[] months = { "Ada", "Basic", "C", "C++", "Cobol", "Forth", "Fortran", "Go", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Python", "Ruby", "Scala", "Scheme" }; ListModel lmonths = new SimpleListModel(months); ]]></zscript> <combobox id="searchCombo" forward="onChange=onSearch" model="@{months}" > <!-- <comboitem self="@{each='months'}" label="@{months}" value="@{months}"> </comboitem> --> </combobox> ``` And here my onSearch method ``` public void onSearch(ForwardEvent event) { System.out.println(searchCombo.getSelectedItem()); prodevt.search(searchCombo.getSelectedItem().toString()); filterCbox.setChecked(true); AnnotateDataBinder binder = (AnnotateDataBinder) win.getVariable( "binder", true); binder.loadAll(); } ```

Original source