0 Replies Latest reply on Jul 13, 2007 5:41 AM by Sohail Khalid

    Problem getting ajax updated value of <f:selectItems>(ajax4j

    Sohail Khalid Newbie

      Hello,
      I am using Ajax4JSF 1.1.1, I have a problem, i wrote this code

      <h:selectOneMenu id="systemId" binding="#{ticketBean.systemsSelectOne}" value="#{ticketBean.systemId}" >
      <f:selectItems value="#{ticketBean.systems}"/>
      <a4j:support event = "onchange" immediate="true" actionListener="#{ticketBean.systemsListener}" reRender = "componentId "/>
      </h:selectOneMenu>
      <h:selectOneMenu id="componentId" binding="#{ticketBean.componentSelectOne}" value="#{ticketBean.componentId}" >
      <f:selectItems id="selectOpt" value="#{ticketBean.components}"/>
      </h:selectOneMenu>

      Problem is that when Systems update the value of Components, the components value changes in SELECT but when i submit this form i don't get new updated values, it shows values, which code at first time run. means display value changes but new value of the dont' change plz tell me how to get updated values ?
      below is the code of systemsListener:
      public void systemsListener(ActionEvent actionEvent){
       String sysId = (String)getSystemsSelectOne().getSubmittedValue();
       Systems s;
       if (sysId.equals("-1")){
       components.add(new SelectItem(new Long(-1),"SELECT ======>"));
       }else{
       SystemsDAO gDAO = new SystemsDAO();
       s=gDAO.findById(Long.parseLong(sysId), true);
       List<Components> compList=BusinessLogic.getComponentsOfSystem(s);
       components.clear();
       components.add(new SelectItem(new Long(-1),"SELECT ======>"));
       for(int i=0;i<compList.size();i++){
       components.add(new SelectItem(compList.get(i).getComponentId(),compList.get(i).getComponentName()));
       }
       }
      
      }