0

Combo box in MVC pattern

asked 2010-03-08 04:32:57 +0800

techvts gravatar image techvts
120 2 5

I had loaded the combobox value by databinding i need to take id of combobox values in database to store i get only values my code is as follows

in zul i had combobox which loads cities but i need id of selected city in DB to store
<zscript>

Iterator iter4=null;
List citylist= signupWnd.getCity();
List citymodel = new LinkedList();
for(iter4=citylist.iterator();iter4.hasNext();)
{ City city=(City)iter4.next();
city.setCity_id(city.getCity_id());
city.setCity_name(city.getCity_name());
citymodel.add(city);
}
Object selected4=citymodel.get(0);
<zscript>


<row>City:<combobox id="CityCmb" model="@{citymodel}" selectedItem="@{selected4}" value="@{selected4.city_name}">
<comboitem self="@{each=city}" label="@{city.city_name}" value="@{city.city_id}"/></combobox></row>

i get city_name in java files by
Combobox shopcity_t = (Combobox)this.getFellow("CityCmb");
shopcity_t.getValue();

but i need id of city for further operations what should i do.

plz help

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2010-03-09 01:37:04 +0800

iantsai gravatar image iantsai
2755 1

you can getSelectedItem and call getValue() of your selected Comboitem.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-03-08 04:32:57 +0800

Seen: 649 times

Last updated: Mar 09 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More