How to bind a Richfaces 'oncomplete' event with jQuery?

I have been using Richfaces 4 But I think the same theory applies.

Up vote 0 down vote favorite share g+ share fb share tw.

I am trying to bind an jQuery function to an 'oncomplete' event on a Richfaces 3.3 a4j:commandButton component. Since I don't want to place the function on the commandButton component itself, I am trying to bind it on document load. I think though that the event does not get bound on document load due since the button is not rendered yet?

Heres how I placed the binding... jQuery(document). Ready(function(){ jQuery('#Btn1'). Bind('complete', function(){ jQuery('#panel1').

SlideUp(750); jQuery('. Selection1'). SlideDown(750); jQuery('.

Next1').show(); }); }); Here is the command button, which is in another page include that is reused in multiple places. This is the reason why I don't want to place this one function on the button itself. So how would I bind an 'oncomplete' function to the Btn1 component from another location, say a parent page?

Much thanks! Jquery richfaces jquery-event-binding link|improve this question asked Jan 25 at 18:09Jaizen214 71% accept rate.

I have been using Richfaces 4 But I think the same theory applies. You are not attaching the event to the commandbutton per se, but to the ajax event that is created by clicking the button (assuming onclick returns true) In actuality it is some magic that JSF will perform that if that component triggers an action it will call that JS when the ajax is rendered. There is nothing per se done before the click, it is realistically a server side attribute.

Richfaces (4 at least) extends the regular JSF ajax (javascript) object and I believe you can attach your handler to that. But that may not be of any real help to you. I had to attach a handler to it to fix some viewstate issues.

You can always attach a function to the oncomplete on the button that references a not necessarily existent function. So and then on any page that includes that button include you could define that function. Not the nicest solution but may be your best bet.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions