1 Reply Latest reply on Jan 9, 2009 4:33 PM by Anne Childress

    suggestionBox - how to pass parm to suggestionAction method

    Anne Childress Newbie

      I'm trying build a generic code suggestionAction method, and to do so, I need the ability to pass a constant to that method. Is there a way to do this?

      For example, something like this:

      <rich:suggestionbox height="120" width="400" usingSuggestObjects="true" onselect="setSuggestion(#{rich:component('suggestion')});"
       suggestionAction="#{CodeCacheBean.autocomplete('CDOFFNSE')}" var="offense" for="offenseSearch" fetchValue="#{offense.code.value}" id="suggestion"
       minChars="3" nothingLabel="No Matches">
       <h:column>
       <h:outputText value="#{offense.code.value}"/>
       </h:column>
       <h:column>
       <h:outputText value="#{offense.description}"/>
       </h:column>
      </rich:suggestionbox>
      


      How can I pass the constant 'CDOFFNSE' to my autocomplete method? Since the normal way to call the autocomplete method is to simply reference the method in suggestionAction (for example, suggestionAction="#{CodeCacheBean.autocomplete}"), but the actual backing bean method accepts an Object as a method parameter, how do I add a second method parameter?

      In other words, I would like to code my autocomplete method like this:

      public List<CodeSearchBean> autocomplete(Object searchString, String codeName) { }
      


      There have been posts that suggested that f:param or actionParameter can be used, but no working examples are shown.

      Thanks in advance for any help you can provide.