How to hide rich:modalPanel on Ajax response in JSF

jsf, richfaces

Solution

It is easy, you can write:

**UPDATED** 

This solution is better, because you don't need javaScript.

<a4j:commandButton reRender="sampleID" action="#{SomeTestAction}" image="sample-button.gif">
      <rich:componentControl for="panelId" operation="hide" event="onclick" />
 </a4j:commandButton>

Or with javaScript

<a4j:commandButton reRender="sampleID" action="#{SomeTestAction}" image="sample-button.gif" oncomplete="javascript:Richfaces.hideModalPanel('panelId');"/>

Or you can submit form, and popup disappear.

<a4j:commandButton reRender="sampleID" action="#{SomeTestAction}" image="sample-button.gif" oncomplete="document.getElementById('Id_form').submit();"/>:

Where "`Id_form`" - is id of the form where `<rich:modalPanel>` was shown.

Problem

I am using jsf reach faces in one application. I am using rich:modalPanel for popup reading some details and submitting tha panel using a4j command button after response from server I want to hide the modalPanel but don't know how to, I am still trying for the solution, Any help Please The code of rich modalPanel is something like this. ``` <rich:modalPanel id="panelID" minHeight="200" minWidth="450" height="200" width="500"> <a4j:commandButton reRender="sampleID" action="#{SomeTestAction}" image="sample-button.gif"/> </rich:modalPanel> ```

Original source