1 Reply Latest reply on Sep 8, 2008 9:45 PM by Nick Belaevski

    Ajax Validator + Modal Panel + Prevent Closing on validation

    demetrio812 Apprentice

      Hi,
      now that Ajax Validation is supported (RC4) by RF, can you suggest some "best practice" to manage with ajax validation and modal panel to prevent closing the mp is validation fails?

      Thank you!

      Demetrio Filocamo

        • 1. Re: Ajax Validator + Modal Panel + Prevent Closing on valida
          Nick Belaevski Master

          Hi,

          Two my suggestions:

          <rich:modalPanel id="mp" minHeight="200" minWidth="450"
           height="200" width="500" zindex="2000">
           <f:facet name="header">
           <h:outputText value="Modal Panel Title" />
           </f:facet>
           <f:facet name="controls">
           </f:facet>
          
           <h:form id="form">
           <a4j:outputPanel ajaxRendered="#{facesContext.maximumSeverity == null}" id="panel">
           <div style="display:none;">
           <script type="text/javascript">//<![CDATA[
           var element = #{rich:element('mp')};
           if (element && element.component) {
           element.component.hide();
           }
           //]]></script>
           </div>
           </a4j:outputPanel>
          
           <h:panelGrid columns="1">
           <rich:messages />
          
           <h:inputText value="" required="true"/>
           <a4j:commandButton value="Submit" />
           </h:panelGrid>
           </h:form>
          
           </rich:modalPanel>
          


          <rich:modalPanel id="mp" minHeight="200" minWidth="450"
           height="200" width="500" zindex="2000">
           <f:facet name="header">
           <h:outputText value="Modal Panel Title" />
           </f:facet>
           <f:facet name="controls">
           </f:facet>
          
           <h:form>
           <h:panelGrid columns="1">
           <rich:messages />
          
           <h:inputText value="" required="true"/>
           <a4j:commandButton value="Submit" oncomplete="if(#{facesContext.maximumSeverity == null}) #{rich:component('mp')}.hide()"/>
           </h:panelGrid>
           </h:form>
           </rich:modalPanel>
          


          a4j:commandButton can be replaced with rich:ajaxValidator.