Friday, June 22, 2012

simulate a4j:jsFunction in richfaces

a4j:jsFunction is very useful. It defines a javascript function you can make ajax call through script by invoking this function. How can you do the same thing without richfaces library?

First, define your action in a hidden command or inputtext field.

<h:commandButton id="mybutton" styleClass="myclass" style="display:none;" ...>
<f:ajax ...></f:ajax>

javascript in YUI

myfunction =function()

javascript in jQuery

After this you can use myfunction anywhere to trigger the ajax behavior.

No comments:

Post a Comment