6 Replies Latest reply on Jul 24, 2009 4:16 PM by Jaime Martin

    SelectOneListBox strange behavior

    Diego Y K Newbie

      Hi,


      I'm having a strange behavior in my page.


      I have a Entity that has a set as a parameter. Something like this.


      @Name("User")
      class User {
         Set<Car> cars;
      }



      On my page the set of childrens are represented as a Select listbox



      <h:selectOneListbox>
           <s:selectItems value="#{user.cars}"
                var="_car" label="#{_car.name}" itemValue="#{_child}"/>
      </h:selectOneListbox>



      I input new cars on a input text box, click on Add button that triggers a action, and set a new car on the User object.


      When I click add, the select box auto updates and the added value appears on my select box.


      To remove a car I select the car on my select, call a action and removes it from the set on the User object. But in this call the select box doesn't updates.


      All my buttons are


      <a4j:commandLink action"#{myAction.addCar}">
      <a4j:commandLink action"#{myAction.removeCar}">
      



      Sometimes when I add a new car the same happens, the object is inserted on my collection but the object on-screen does not shows it.


      For testing purposes I created another commandLink but without a action, when I click the new link the select box updates and shows the newly added Car or removes the previously removed Car.


      I tried to put a a4j:outputPanel outside my select box and then put the outputPanel id as a reRender param on mine commandLink.