tags:

views:

426

answers:

1

I'm using JSF 2.0 and it's new (actually old, but now incorporated in JSF) ajax features.

I have something like this:

<h:inputText id="name" value="#{coordinatesMBean.name}"/>
<h:commandButton value="Reverse me!">
  <f:ajax execute="name" render="reverseName"/>
</h:commandButton>
<h:outputText id="reverseName" value="#{coordinatesMBean.reverseName}"/>

It works fine, after hitting button value from inputText is sent to server, put into managed bean, and reverseName is rerendered with new data.

What I want to do is not only rerendering reverseName, but also call some Javascript function when ajax response is received.

+2  A: 

<f:ajax> has onevent and onerror attributes. Give them a try.

Alternatively, Richfaces <a4j:support> has the oncomplete attribute for that purpose.

Bozho
I think oncomplete is what I need. onevent is fired when request is sent to server, before response is received and handled, right? So it's not good for me.
amorfis
Ok, onevent is triggered 3 times, with different statuses:1. when ajax request is sent to server (I don't remember the status)2. when response is received (status = complete)3. also when response is received (status = success)
amorfis