0

In my case, I want to add an action to my rich:popupPanel like this:

   <rich:popupPanel id="popup" show="#{tC5Bean.popupCheck}"  autosized="true" resizeable="false">
         <f:facet name="header">
        <h:outputText value="Simple popup panel" />
    </f:facet>
    <f:facet name="controls">
        <h:outputLink value="#" onclick="#{rich:component('popup')}.hide(); return false;">
            X
        </h:outputLink>
    </f:facet>
        <p>
        Hihi Click this button to hide
        <br/>
        <h:commandButton value="Close" onclick="alert('#{tC5Bean.popupCheck}')" action="#{tC5Bean.closePopupAction()}"/>
        </p>
    </rich:popupPanel>

And the Managed Bean like this:

public void closePopupAction(){
    //do some action
    popupCheck=false;
}

But the closePopupAction method is failed to active. I don't know what cause this and how to resolve this problem.

If you have any idea, please share with me. You can view my error online and download our application at (please view testcase5):

http://phandanghung.wordpress.com/2012/03/22/welcome-to-my-jsf-tutorial-project/

Sincerely thanks.

Hung Phan Dang
  • 360
  • 1
  • 4
  • 20

1 Answers1

0

You can change your commandButton to an a4j:

<a4j:commandButton value="Close" oncomplete="if (#{facesContext.maximumSeverity==null}) #{rich:component('popup')}.hide()"/>

You don't even need a backing bean to close the popup.

Nick Humphrey
  • 611
  • 6
  • 15