1 2 Previous Next 18 Replies Latest reply on Jun 11, 2013 10:52 AM by Immo Benjes Go to original post
      • 15. Re: Can I use rich:autocomplete for setting complex value?
        Newbie

        Hi Rizwan,

         

        This is the solution I finally have used (omitted elements not relevant):

         

        <rich:autocomplete id="suggestionVial#{id}" minChars="1"
            autocompleteMethod="..." var="vial" fetchValue="..." value="..." mode="..."
            onselectitem="updateElement(event.target.previousSibling.previousSibling.value, event.target.previousSibling.value)">
            <h:inputText value="#{vial[2]}" styleClass="oculto" readonly="true"/> <!-- first attribute to updateElement -->
            <h:inputText value="#{vial[3]}" styleClass="oculto" readonly="true"/> <!-- second attribute to updateElement -->
            <h:outputText value="#{vial[0]} #{vial[1]}" styleClass="label"/>       
        </rich:autocomplete> 

        <a4j:jsFunction name="updateElement" action="#{bean.updateElement}" render="...">
            <a4j:param name="atrb1" assignTo="#{bean.atrib1}"/>
            <a4j:param name="atrb2" assignTo="#{bean.atrib2}"/>
        </a4j:jsFunction> 

         

        Regards,

        Rubén.

        • 16. Re: Can I use rich:autocomplete for setting complex value?
          Christian Peter Expert

          Nice, I'll try that some time.

           

           

          For richfaces 3.3.3 I've created a new suggestion box based on UIInput and jQuery autocomplete on the client. I you the (or an) EntityConverter (from seam in my case) to convert between String and Object and the other way around.

          • 17. Re: Can I use rich:autocomplete for setting complex value?
            mbickel Newbie

            FWIW, updating from RF3.3 to 4 went fine till I hit this roadblock. Ruben's solution seams to work, but c'mon guys.. that's just ugly as hell (and depends on the HTML layout)

            I'm all for using <rich:select> for this, but without the ability to dynamically load suggestions from the server this is a no-go.

            • 18. Re: Can I use rich:autocomplete for setting complex value?
              Immo Benjes Newbie

              Have there been any developments in this respect? It really is a step backwards from RichFaces 3!

              I've tried to add a:ajax with a listener method to the autocomplete like

              <rich:autocomplete var="obj" ....>

              <a:ajax event="selectitem" render="#{reRender}" listener="#{suggestionBean.selected(obj}">

              ..

              </rich:autocomplete>

              But only null is passed to that method.

               

              I've tried to use Ruben's approach but that only seems to work when the user selects something with the mouse, not when the user selects the row with the keyboard. In this case the target of the event is the actual input field. The info which row was selected seems to be lost already at that point.

              1 2 Previous Next