How to add both server-side and client-side event handler in RichFaces

1.2k views Asked by At

So, i need to focus a richfaces tag when an option is selected in my suggestionBox. Normally this wouldnt be a problem but I have the following code:

<rich:suggestionbox fetchValue="#{cap.nom_comp}"
suggestionAction="#{gestionRankingBean.autocompleteMedicamento}"  
var="cap"
for="statesinput" id="suggestion" tokens=","
onselect="lossFocus()">

<h:column>
    <h:outputText value="#{cap.nom_comp}" />
</h:column>

<a4j:support event="onselect" ajaxSingle="true" reRender="target">
    <f:setPropertyActionListener value="#{cap.id}" 
        target="#{gestionRankingBean.sugerencia}" /> 
</a4j:support>

</rich:suggestionbox>

My problem is the a4j:support tag is not going to work if i leave the onselect event on the line 5.It seems like i cannot use the same event in this way.

lossFocus() is a javascript function that just does what i want ( pure jquery). So any way to do this? I was thinking if there is some way to capture the onselect event of the suggestionBox with jquery an make my life easier. But i dont know how-

1

There are 1 answers

1
Max Katz On BEST ANSWER

Try using oncomplete="lostFocus()" on a4j:support. You could also try onsubmit.