This content has been marked as final.
Show 1 reply
-
1. Re: How to close a modalPanel?
ilya_shaikovsky May 23, 2007 6:20 AM (in response to vh)for me - the next code works as you defined.
<ui:define name="body"> <f:verbatim> <a href="javascript:Richfaces.showModalPanel('_panel',{left:'auto', top:'auto'})">Show Modal Panel</a> </f:verbatim> <rich:modalPanel id="_panel"> <f:facet name="header"> <h:outputText value="test"></h:outputText> </f:facet> <h:form id="mpform"> <a4j:outputPanel ajaxRendered="true"> <h:messages id="error"></h:messages> </a4j:outputPanel> <h:inputText value="#{bean.property}" required="true"></h:inputText> <a4j:commandLink value="click" oncomplete="windowclose();" reRender="test"/> </h:form> </rich:modalPanel> <script type="text/javascript"> //<![CDATA[ function windowclose(){ if (document.getElementById('mpform:error')==null){ Richfaces.hideModalPanel('_panel'); }; }; //]]> </script> </ui:define>
My function just check if the messages appeared and depending on this condition closes the window or does nothing.