2 Replies Latest reply on Apr 2, 2012 6:55 AM by ahahne

    rich:tree selection while validation error

    gensys

      Hi all,

       

      I am working with the following rich:tree:

       

          <rich:tree id="parametersTree"
               value="#{treeBean.parameterNodes}"
               nodeSelectListener="#{treeBean.processTreeSelection}"
               reRender="configPanel"
               ajaxSubmitSelection="true"
               adviseNodeSelected="#{treeBean.nodeSelected}"
               var="nodeName"
               <rich:treeNode>
                   <h:outputText value="#{nodeName}" />
               </rich:treeNode>
          </rich:tree>

       

      I want to prevent the change of the selected node if there is a validation error and <rich:message> is shown. treeBean.nodeSelected method has been called only when there is no validation error - which seams to be ok. Nevertheless, the selected node is changed in the brawser.

       

      Any suggestions?

       

      Thanks

        • 1. Re: rich:tree selection while validation error
          gensys

          Hi,

           

          I have sloved the problem. I'm using JS event onselected of the <rich:tree> like this:

           

               onselected="{if(#{treeBean.valid}==false){return false;}};"

           

          The code in the bean is:

           

              public boolean isValid()
              {
                  FacesContext context = FacesContext.getCurrentInstance();
                  boolean res = !context.getMessages().hasNext();
                  return res;
              }

           

          I hope this will help somebody else. Cheers!

          • 2. Re: rich:tree selection while validation error
            ahahne

            Hey Gen Sys,

             

            in which RichFaces version did the described workaround solve your problem? I tried the same approach with RF 3.3.3-Final without success. And there is an open ticket related to this topic: https://issues.jboss.org/browse/RF-6732.

             

            Kind regards

            Andreas