3 Replies Latest reply on Aug 25, 2009 10:13 AM by giuseppe naddeo

    s:selectItems inside a h:selectManyCheckbox

    giuseppe naddeo Newbie

      hi


      I'm seeing a strange behaviour of s:selectItems inside a h:selectManyCheckbox



      in detail there is a form




      <a:form id="idForm" ajaxRendered="true">
      
      A<h:outputText id="rawList" value="#{myForm.selectedTags}"/>
      
      B<h:selectManyCheckbox id="boxList" value="#{myForm.todelTags}" layout="pageDirection">
         <s:selectItems value="#{myForm.selectedTags}" var="_tag" label="#{_tag}"/>
      </h:selectManyCheckbox>
      
      <a:commandButton id="delete" value="delete" action="#{myForm.doDeleteTag}" reRender="boxList, rawList" />
      
      </a:form>





      doDeleteTag code is


      public void doDeleteTag() {
              selectedTags.removeAll(todelTags);
              todelTags = null;
              todelTags = new ArrayList<String>();
      }




      everything is very simple:
      there is a list of tags. every tag has a checkbox (point A)
      user can select several checkboxes and delete them.


      after delete, the list is re-rendered to show the new list


      the problem is that after user clicks on commandButton, boxList is the same as before. no change.


      as test, I added an h:outputText with same value (point B).
      rawList works correctly.


      in few words


      before I click I see:


      A[tag1, tag2, tag3]

      B

      checkbox tag1

      checkbox tag2

      checkbox tag3


      suppose I select tag2 and click,
      now I see:


      A[tag1, tag3] <--correct!

      B

      checkbox tag1

      checkbox tag2 <--why??

      checkbox tag3



      what's wrong?????
      why checkbox tag2 is still there??


      thanks for any help.