Javascript function callback after async command call

Is there any way to register a javascript callback function with async. command button. My requirement is that when async command button completes the server side action and refresh the client side control then the callback javascript function is called.

Is there any OnComplete event on async. command button

Thanks in advance


Yes you can register client side callback function. For example:

function (commandID) { alert(commandID); }

For a complete API reference please see:

Thanks Alex!

This is what is was looking for…

Where do you provide "CAF.model(’#{activePageBean.clientIds[“asyncButton”]}’).addActionCompleteListener(
function (commandID) { alert(commandID); }
); "?
Can we add actionCompleteListener to command button as well?

Hey Joy,

you can add that script anywhere in the page in a simple script block. It works only on async command contorls…the same does not work on Command button as behavior of command button is to submit whole form and refreshes whole page. the state will be lost and all your listeners will be wiped off.