1 Reply Latest reply on Oct 11, 2011 3:52 PM by Joseph Neubauer

    rich autocomplete send parameter before executing autocompleteMethod

    Pablo Ochoa Newbie

      Hello, I'm am in need to post a param before the autocomplete method is executed, in order to 1) Reuse code, and 2) Perform a particular operation depending of the component that it's calling it.


      So for example I would like something like this:



      <rich:autocomplete id="administradorAutocomplete"
                                                  var="administrador" converter="entityConverter">
                                          <f:param name="type" value="CertainEntity"></f:param>


      However this is not working, So the question is what event should I intercept using a4j:ajax in order to achieve this behavior.


      And by the way, is there a place where I can find an explanation of all the properties of autocomplete?? For example, what is the usage of fetchValue?, I have checked the LiveDemos however there's only the html part of the code, not the bean... and only basic properties are shown.


      Thanks a lot.

        • 1. Re: rich autocomplete send parameter before executing autocompleteMethod
          Joseph Neubauer Newbie

          Hello Pablo,


          I had a similiar problem. My page has to transfer information about the autocomplete before the autocomplete request is done. I achieved this by using jsFunction. My autocomplete looks like:


          <rich:autocomplete mode="ajax" showButton="true" value="#{conf.fieldValue}" autocompleteMethod="#{BackingBean.search.autocomplete}" 
                                           minChars="3" onfocus="sendInfo('#{conf.label}')">


          Depending on conf.label (conf is a forEach variable) different data is fetched by the backing bean in the autocomplete method.

          The transfer of this information is done by jsFunction (just after the autocomplete declaration):


          <a4j:jsFunction name="sendInfo">
               <a4j:param name="param1" assignTo="#{BackingBean.search.currentAutocomplete}"></a4j:param>

          Just, when the user puts the focus on a specific autocomplete "sendInfo" is executed with one parameter which is bound to the backing bean.


          This solved my issue.