1
votes

We are moving an application to a newer version of RichFaces and JSF (4.2.2 and 2.0 respectively I believe) and I'm trying to make the necessary adjustments to get the app to function like it did before (I don't have a ton of experience with jsf/richfaces).

On one of our pages, when we click a button we need to display a pop-up that says "one moment please..." and when processing is done the pop up needs to go away. I started out trying something like this:

<a4j:commandButton id="viewEditTop" value="#{SearchBean.mode}"
                        action="#{SearchResultsBean.processSelected}"
                        styleClass="generalButton" onclick="#{rich:component('wait-dialog')}.show()" oncomplete="#{rich:component('wait-dialog')}.hide()"/>

But the oncomplete doesn't seem to fire. The pop-up gets displayed, but never goes away. After a ton of research and trying various things (mostly trying to call an a4j:status and trying to find details info about how to trigger oncomplete, and statuses and whatnot) I'm at a loss of what to do next.

Does anyone know how to get the oncomplete to fire? or if i'm supposed to be using an a4j:status, how I would get the status to work? I defined the status, added "onstart" and "onstop" to show/hide the pop-up and set my a4j:commandButton status to reference the status i created and it didn't work.

Thanks!

1
Try to remove the action and add a console.log('your custom message') in the "oncomplete" method to check if the action has been invoked. After that, make sure the SearchResultsBean.processSelected method doesn't return a String and don't generate any exceptions. - Luiggi Mendoza
Thanks for the info, I'll have to look into the string theory a bit. The processSelected method does return a string. Why does that cause a problem? Using the older versions of jsf/richfaces they had an oncomplete method that worked even though processSelected returns a string. The string it returns is used for navigation that's configured in faces-config.xml (though in the case i'm having trouble with an empty string is returned and i just want the popup to go away instead of navigating to a different page). - cschick2317
When the navigation is fired, the "oncomplete" method won't fire. For this case, you could use <a4j:status onstart="#{rich:component('wait-dialog')}.show()" onstop="#{rich:component('wait-dialog')}.hide()" />, and erase those calls from your <a4j:commandButton> - Luiggi Mendoza
Did you ever find a solution? Running into the exact same issue. - Dave4988
Sorry for the late reply @Dave4988, but it turned out that it was caused by an external library we where using. - Espen S.

1 Answers

1
votes
<a4j:commandButton id="viewEditTop" value="#{SearchBean.mode}"
                            action="#{SearchResultsBean.processSelected}"
                            styleClass="generalButton" onbegin="#{rich:component('wait-dialog')}.show()" oncomplete="#{rich:component('wait-dialog')}.hide()"/>

you can try this i think it will work 4 u...