title: zk selecting combobox item programmatically
body: <p>I cannot set the value of combobox programmatically can some one tell me what missing in the code</p>
  
  <pre><code> public class Profile extends Window implements AfterCompose {
  
      @Override
      public void afterCompose() {
         Session session = Sessions.getCurrent(false);
                  ApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(
                  (ServletContext) getDesktop().getWebApp().getNativeContext());
  
          UsersDao usersDao = (UsersDao) ctx.getBean("daoUsers");
  
  
          User user = (User) session.getAttribute("user");
          user = usersDao.getUser(user.getUsername(),user.getPassword());
  
          Textbox username_t = (Textbox) this.getFellow("username");
          Textbox password_t = (Textbox) this.getFellow("password");
          Textbox conpassword_t = (Textbox) this.getFellow("con_password");
          Textbox firstname_t = (Textbox) this.getFellow("firstName");
          Textbox lastname_t = (Textbox) this.getFellow("lastName");
          Textbox email_t = (Textbox) this.getFellow("email");
          Combobox hintQuestion_t = (Combobox) this.getFellow("hintQuestion");
          Textbox hintAnswer_t = (Textbox) this.getFellow("hintAnswer");
          Combobox locale_t = (Combobox) this.getFellow("locale");
          Combobox authority_t = (Combobox) this.getFellow("authority");
  
          username_t.setText(user.getUsername());
          firstname_t.setText(user.getUserDetails().getFirstName());
          lastname_t.setText(user.getUserDetails().getLastName());
          email_t.setText(user.getUserDetails().getEmail());
          Comboitem selectedItem = getSelectedIndexComboboxItem(hintQuestion_t, user.getHintQuestion());
          hintQuestion_t.setSelectedItem(selectedItem);
          hintAnswer_t.setText(user.getHintAnswer());
          selectedItem = getSelectedIndexComboboxItem(locale_t, user.getUserDetails().getLocale());
          locale_t.setSelectedItem(selectedItem);
          selectedItem = getSelectedIndexComboboxItem(authority_t, ((Authority)user.getAuthorities().toArray()[0]).getRole());
          authority_t.setSelectedItem(selectedItem);
  
  
      }
  
     private Comboitem getSelectedIndexComboboxItem(Combobox combobox, String value) {
          List&lt;Comboitem&gt; items = combobox.getItems();
          Comboitem item = items.get(0);
          for (int i = 0; i &lt; items.size(); i++) {
              Comboitem comboitem = items.get(i);
              String label = (String)comboitem.getLabel();
              String cval = (String)comboitem.getValue();
              if ((label!=null &amp;&amp; label.equalsIgnoreCase(value)) || (cval != null  &amp;&amp; cval.equalsIgnoreCase(value))) {
                  item = comboitem;
                  break;
              }
          }
          return item;
      }
  }
  </code></pre>
  
  <p>// zk file</p>
  
  <pre><code>&lt;window id="profile" use="com.jf.web.zk.ui.Profile"&gt;
          &lt;tabbox  id="tabbox" width="40%" &gt;
              &lt;tabs&gt;
                  &lt;tab label="Account Information"/&gt;
                  &lt;tab label="Personal Information"/&gt;
                  &lt;tab label="Contact Details"/&gt;
              &lt;/tabs&gt;
              &lt;tabpanels&gt;
                  &lt;tabpanel&gt;
                      &lt;grid&gt;
                          &lt;rows&gt;
                              &lt;row&gt;
                                  &lt;label value="${i18nUtils.message('user.username')}"/&gt;
                                  &lt;hbox&gt;
                                      &lt;textbox id="username" /&gt;*,a-zA-Z,0-9
                                  &lt;/hbox&gt;
                              &lt;/row&gt;
                              &lt;row&gt;
                                  &lt;label value="${i18nUtils.message('user.password')}"/&gt;
                                  &lt;hbox&gt;
                                      &lt;textbox id="password" type="password"/&gt;*
                                  &lt;/hbox&gt;
                              &lt;/row&gt;
                              &lt;row&gt;
                                  &lt;label value="${i18nUtils.message('registration.user.password.confirm')}"/&gt;
                                  &lt;hbox&gt;
                                      &lt;textbox id="con_password" type="password"/&gt;*
                                  &lt;/hbox&gt;
                              &lt;/row&gt;
                              &lt;row&gt;
                                  &lt;label value="${i18nUtils.message('user.details.first.name')}"/&gt;
                                  &lt;hbox&gt;
                                      &lt;textbox id="firstName" type="text"/&gt;*
                                  &lt;/hbox&gt;
                              &lt;/row&gt;
                              &lt;row&gt;
                                  &lt;label value="${i18nUtils.message('user.details.last.name')}"/&gt;
                                  &lt;hbox&gt;
                                      &lt;textbox id="lastName" type="text"/&gt;*
                                  &lt;/hbox&gt;
                              &lt;/row&gt;
                              &lt;row&gt;
                                  &lt;label value="${i18nUtils.message('user.details.email')}"/&gt;
                                  &lt;hbox&gt;
                                      &lt;textbox id="email" type="text"/&gt;*
                                  &lt;/hbox&gt;
                              &lt;/row&gt;
                              &lt;row&gt;
                                  &lt;label value="${i18nUtils.message('user.hint.question')}"/&gt;
                                  &lt;hbox&gt;
                                      &lt;combobox id="hintQuestion" onCreate='self.setSelectedIndex(1);'&gt;
                                          &lt;comboitem label="${i18nUtils.message('user.hint.question.possible.value1')}" /&gt;
                                          &lt;comboitem label="${i18nUtils.message('user.hint.question.possible.value2')}" /&gt;
                                          &lt;comboitem label="${i18nUtils.message('user.hint.question.possible.value3')}" /&gt;
                                          &lt;comboitem label="${i18nUtils.message('user.hint.question.possible.value4')}" /&gt;
                                          &lt;comboitem label="${i18nUtils.message('user.hint.question.possible.value5')}" /&gt;
                                      &lt;/combobox&gt;*
                                  &lt;/hbox&gt;
                              &lt;/row&gt;
                              &lt;row&gt;
                                  &lt;label value="${i18nUtils.message('user.hint.answer')}"/&gt;
                                  &lt;hbox&gt;
                                      &lt;textbox id="hintAnswer" type="text"/&gt;*
                                  &lt;/hbox&gt;
                              &lt;/row&gt;
                              &lt;row&gt;
                                  &lt;label value="${i18nUtils.message('user.details.locale')}"/&gt;
                                  &lt;hbox&gt;
                                      &lt;combobox id="locale" onCreate='self.setSelectedIndex(1);self.setReadonly(true);'&gt;
                                          &lt;comboitem label="${i18nUtils.message('user.details.locale.en')}" value="en_US"/&gt;
                                          &lt;comboitem label="${i18nUtils.message('user.details.locale.bg')}" value="bg_BG"/&gt;
                                      &lt;/combobox&gt;*
                                  &lt;/hbox&gt;
                              &lt;/row&gt;
                              &lt;row&gt;
                                  &lt;label value="${i18nUtils.message('authority.account.type')}"/&gt;
                                  &lt;hbox&gt;
                                      &lt;combobox id="authority" onCreate='self.setSelectedIndex(0);self.setReadonly(true);'&gt;
                                          &lt;comboitem label="${i18nUtils.message('authority.job.seeker')}" value="Job Seeker"/&gt;
                                          &lt;comboitem label="${i18nUtils.message('authority.employer')}" value="Employer"/&gt;
                                          &lt;comboitem label="${i18nUtils.message('authority.hra')}" value="Human Resource Agency"/&gt;
                                          &lt;comboitem label="${i18nUtils.message('authority.advertiser')}" value="Advertiser"/&gt;
                                      &lt;/combobox&gt;*
                                  &lt;/hbox&gt;
                              &lt;/row&gt;
                          &lt;/rows&gt;
                      &lt;/grid&gt;
                  &lt;/tabpanel&gt;
              &lt;/tabpanels&gt;
          &lt;/tabbox&gt;
          &lt;grid width="40%"&gt;
              &lt;rows&gt;
                  &lt;row&gt;
                      &lt;button label="${i18nUtils.message('bttn.save')}" onClick="save()"/&gt;
                      &lt;button label="${i18nUtils.message('bttn.cancel')}" onClick="cancel()"/&gt;
                  &lt;/row&gt;
              &lt;/rows&gt;
          &lt;/grid&gt;
      &lt;/window&gt;
  &lt;/zk&gt;
  </code></pre>
  
  <p>The "getSelectedIndexComboboxItem()" does return the correct selected item but there seems no effect on the UI. Like for example the locale is set to default Bulgarian language and I need to set it to English.</p>