4 Replies Latest reply on Apr 15, 2011 6:06 AM by angela

    Problem getting the checked values on selectBooleanCheckBox

    angela

      Hello everybody!
      I'm fighting for a while now with problem and didn't yet find what's missing !
      a have a list of questions which I made selectable using the selectBooleancheckbox in my question datatable!
      so here are the changes I made :
      in my question entity bean:Refquestion.java




      private boolean selected;
      @Transient 
          public boolean isSelected() {
               return this.selected; 
               }
          public void setSelected(boolean selected) {
               this.selected = selected; 
          
          }


      This is my MultiQuestionAction.java:(I made the store method just to test if the elements are getting selected)



      import org.jboss.seam.ScopeType;
      import org.jboss.seam.annotations.In;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Scope;
      import org.domain.qmsv1.entity.*;
      
      @Scope(ScopeType.PAGE)
      @Name("multiQuestionAction")
      public class MultiQuestionAction implements MultiQuestion{
      @In
      private RefquestionList refquestionList;
      
      
      public void store()
      {
           for(Refquestion r:refquestionList.getResultList())
           {
                System.out.println("refq");
                if(r.isSelected())
                {
                     System.out.println("refqSelect");
                
                }
           }
           refquestionList.refresh();
      }
      
      }



      and here is my jsf page RefquestionList.xhtml


       


        <rich:dataTable id="refquestionList"
                      var="_refquestion"
                    value="#{refquestionList.resultList}"
                    selectionMode="single" selectedClass="selection"
                 rendered="#{not empty refquestionList.resultList}">
              <h:column>
                  <f:facet name="header">
                      <ui:include src="layout/sort.xhtml">
                          <ui:param name="entityList" value="#{refquestionList}"/>
                          <ui:param name="propertyLabel" value="Idref question"/>
                          <ui:param name="propertyPath" value="refquestion.idrefQuestion"/>
                      </ui:include>
                  </f:facet>
                  <h:outputText value="#{_refquestion.idrefQuestion}"/>
              </h:column>
              <h:column>
                  <f:facet name="header">
                      <ui:include src="layout/sort.xhtml">
                          <ui:param name="entityList" value="#{refquestionList}"/>
                          <ui:param name="propertyLabel" value="Jalon idjalon"/>
                          <ui:param name="propertyPath" value="refquestion.jalon.idjalon"/>
                      </ui:include>
                  </f:facet>
                  <h:outputText value="#{_refquestion.jalon.idjalon}"/>
              </h:column>
              <h:column>
                  <f:facet name="header">
                      <ui:include src="layout/sort.xhtml">
                          <ui:param name="entityList" value="#{refquestionList}"/>
                          <ui:param name="propertyLabel" value="Exigence idexigence"/>
                          <ui:param name="propertyPath" value="refquestion.exigence.idexigence"/>
                      </ui:include>
                  </f:facet>
                  <h:outputText value="#{_refquestion.exigence.idexigence}"/>
              </h:column>
              <h:column>
                  <f:facet name="header">
                      <ui:include src="layout/sort.xhtml">
                          <ui:param name="entityList" value="#{refquestionList}"/>
                          <ui:param name="propertyLabel" value="Question"/>
                          <ui:param name="propertyPath" value="refquestion.question"/>
                      </ui:include>
                  </f:facet>
                  <h:outputText value="#{_refquestion.question}"/>
              </h:column>
                
              <rich:column styleClass="action">
                  <f:facet name="header">Select</f:facet>
                  <h:selectBooleanCheckbox value="#{_refquestion.selected}"/>
              </rich:column>
          </rich:dataTable>





      <s:button action="#{multiQuestionAction.store()}"
                          value="test selected"/>



      My problem is that the isSelected always returns False!!
      I'm loosing my mind here please Help
      Thank you