1 Reply Latest reply on Nov 30, 2011 5:21 AM by jakeclarkson87

    Getting raw value of <rich:listShuttle>

    jakeclarkson87

      Hi there,

       

      I need to validate the value of a <rich:listShuttle> element. I have bound the element to a UIListShuttle instance in my backing bean. However, I'm not sure how to get the current value of the element.

       

      I have tried:

       

      this.testListShuttle.getTargetSelection()
      

       

      But this does not contain the current target's Set of values, it just contains the model values. I want the values that in sync with the view, i.e. before the Update Model Values stage of the JSF lifecycle.

       

      Hope this makes sense. Thanks.

        • 1. Re: Getting raw value of <rich:listShuttle>
          jakeclarkson87

          I have now resolved this issue.

           

          In my validation I was able to get the value as follows; I needed to check that the a collection of three <rich:listShuttle> elements had at least one element selected between them, I acheived this as follows.

           

          ArrayList selectedElements1 = (ArrayList) this.availableElementsShuttle1.getTargetValue();
          ArrayList selectedElements2 = (ArrayList) this.availableElementsShuttle2.getTargetValue();
          ArrayList selectedElements3 = (ArrayList) this.availableElementsShuttle3.getTargetValue();
          
          if (selectedElements1 != null && selectedElements1.isEmpty()
                  && selectedElements2 != null && selectedElements2.isEmpty() 
                  && selectedElements3 != null && selectedElements3.isEmpty()) {
              // throw ValidatorException as all the listShuttle elements are empty
          }