0

I use a richfaces:suggestionBox in the following manner:

<h:inputText
    value="#{myBean.data}">
    <rich:suggestionbox width="100" ajaxSingle="true"
        selfRendered="true" var="result"
        suggestionAction="#{autoBean.autocomplete}"
        >
        <h:column>
            <h:outputText value="#{result.getValue('txtsugg')}" />
        </h:column>
    </rich:suggestionbox>  

All goes well, bu now I need to intercept the user selection because when the user select a particular value I need to do an action over the server and after refresh a piece of page.

For example:
1) user write 'ala'
the suggestionbox suggest him 'ala1' 'ala2' 'ala3' ...
2) user select 'ala2' (press enter, click over it or change focus)
a server action must be called and a refresh of one piece of the page.

Hope I explain my problem.

Giant2
  • 461
  • 1
  • 4
  • 15

1 Answers1

0

try if this works.

<h:inputText
    value="#{myBean.data}"/>
   <a:support event="onblur" reRender="xxx"/>
</h:inputText>
<rich:suggestionbox width="100" ajaxSingle="true" selfRendered="true" var="result" suggestionAction="#{autoBean.autocomplete}">
        <h:column>
            <h:outputText value="#{result.getValue('txtsugg')}" />
        </h:column>
        <a:support event="onselect" reRender="xxxx">
           <f:setPropertyActionListener value="#{result.getValue('txtsugg')}"
                                    target="#{myBean.data}" />
        </a:support>
</rich:suggestionbox>  
Trind
  • 1,583
  • 4
  • 18
  • 38
  • Thanks @Trind with some easy modification it goes. I use your idea to put the a4j support over the suggestionbox. For now it goes well, I hope this a4j support doesn't give me problem in the future. :-) – Giant2 Jul 06 '12 at 10:13