1 Reply Latest reply on Jan 12, 2009 4:40 AM by ilya_shaikovsky

    h:selectBooleanCheckBox with RichFaces doesn't Submit the se

    mail2bansi

      I thoroughly checked my program number of times and unable to found where the mistake/mystery is

      I know its simple stuff . Having spent so much time with JSF unable to figure out whats going wrong

      Here are the code snippets

      <f:subview xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich">
      <a4j:region selfRendered="true">
      <rich:modalPanel id="chooseFieldPopup" width="600" height="500" style="overflow:auto!important">
      <f:facet name="header">
      <h:outputText id="title" value="Choose Fields" />
      </f:facet>
      <f:facet name="controls">
      <h:panelGroup id ="fieldgroup" >
      <h:graphicImage value="/images/close.png" style="cursor:pointer" id="hidelink" />
      <rich:componentControl for="chooseFieldPopup" attachTo="hidelink" operation="hide"
      event="onclick" />
      </h:panelGroup>
      </f:facet>
      <h:form id="chooseFieldForm">
      <rich:panel id="fieldPanel">
      <f:facet name="header">Select Output Fields</f:facet>
      <h:panelGrid styleClass="detail" columnClasses="label" >
      <h:panelGroup>
      <h:selectBooleanCheckbox id="bldg" value="#{deviceMasterFormBean.flagBldg}" />
      <rich:spacer width="3px" />
      <h:outputLabel><h:outputText value="Building" /></h:outputLabel>
      <h:message for="bldg" />
      </h:panelGroup>

      </h:panelGrid>
      </rich:panel>
      <h:panelGroup styleClass="buttonBar" >
      <a4j:commandButton id="save" value="Save Fields" action="#{deviceMasterFormBean.saveChooseFields}" styleClass="button" >
      <rich:componentControl for="chooseFieldPopup" operation="hide"
      event="onclick" />
      </a4j:commandButton>
      </h:panelGroup>
      </h:form>
      </rich:modalPanel>
      </a4j:region>
      </f:subview>


      //Choose search Output Fields
      /**Flag for Bldg */
      private boolean flagBldg = false;

      /**Flag for Floor */
      private boolean flagFloor = false;

      /**
      * @return the flagBldg
      */
      public boolean isFlagBldg()
      {
      return this.flagBldg;
      }

      /**
      * @param flagBldg the flagBldg to set
      */
      public void setFlagBldg(boolean flagBldg)
      {
      this.flagBldg = flagBldg;
      }

      /**
      * @return the flagFloor
      */
      public boolean isFlagFloor()
      {
      return this.flagFloor;
      }

      /**
      * @param flagFloor the flagFloor to set
      */
      public void setFlagFloor(boolean flagFloor)
      {
      this.flagFloor = flagFloor;
      }

      public String saveChooseFields()
      {
      FacesContext context = FacesContext.getCurrentInstance();
      if(flagBldg == true){

      }
      if(flagFloor == true){

      }
      return null;
      }



      Even though i select the checkboxes on UI, the "flagBldg" and "flagFloor" are always false. I verified this using debugger breakpoints in setXXX() methods.

      The reason i used the term "Mystery" is it because the selected value gets submitted in Firefox 3.0 but not in IE 6.0

      Please note their is no "rendered" attribute to the commandButton which if returns false , will not submit the selected value.

      The other reasons for not submitting the selected value might be Validation/Converter phase. But its simple checkbox with true or false value , which is mapped to backing bean property of type boolean with setXXX() methods. So I hope validation phase passes succesfully

      So I am not sure in which phase it fails ???

      Any pointers/suggestions will be greatly appreciated