6 Replies Latest reply on May 28, 2009 5:56 AM by ilya_shaikovsky

    Problem using Richfaces.hideModalPanel

      Hi,
      I am using Richfaces.hideModalPanel to hide a modal panel which was displayed as part of request submit confirmation. Please find the code below


      <rich:modalPanel id="metadata-inprogress" minHeight="100" minWidth="250" height="100"
       width="250" zindex="2000">
       <f:facet name="header">
       <h:outputText value="Metadata Batch insertiong request submitted...."></h:outputText>
       </f:facet>
       <f:facet name="controls">
       <h:graphicImage value="/images/close.png" style="cursor:pointer"
       onclick="Richfaces.hideModalPanel('metadata-inprogress')" />
       </f:facet>
       <h:outputText id="mptext1"
       value="Metadata Batch insert requested Successfully. You will get email after completion..." />
       <rich:panel styleClass="invisiblePanel">
       <a4j:commandButton id="mpCloseButton" styleClass="smallText" style="text-align:center;" onclick="Richfaces.hideModalPanel('metadata-inprogress')"
       value="OK" />
       </rich:panel>
      </rich:modalPanel>


      I am using <rich:messages> to display messages, in case any error occurs during request processing. The problem is on clicking ok in the above <a4j:commandButton> , the messages are getting cleared. But if any error occurs, I want messages to be there though User can close the message panel.
      Any help

        • 1. Re: Problem using Richfaces.hideModalPanel
          nbelaevski

          Hi,

          Do not use a4j:commandButton just to close panel, use common HTML button tag

          • 2. Re: Problem using Richfaces.hideModalPanel

            Thanks.
            I changed it to <h:commandLink value="Close" style="cursor:pointer" onclick="Richfaces.hideModalPanel('metadata-inprogress')" />

            • 3. Re: Problem using Richfaces.hideModalPanel

              Is it possible to fire a javascript function when messages are displayed as part of <rich:messages/> something like

              <rich:messages>
              {function to be called}
              </rich:messages>

              • 4. Re: Problem using Richfaces.hideModalPanel
                ilya_shaikovsky

                 


                Thanks.
                I changed it to <h:commandLink value="Close" style="cursor:pointer" onclick="Richfaces.hideModalPanel('metadata-inprogress')" />


                do you really need a submit after modal closure? If no add return false; after hide statement.


                Is it possible to fire a javascript function when messages are displayed as part of <rich:messages/> something like


                you could check in request control oncomplete if the messages were risen and execute the js you need in this case. or you could add some script in conditionally rendered (rendered if messages present) outputPanel so it will be evaluated only if messages persent.

                • 5. Re: Problem using Richfaces.hideModalPanel

                  Thanks and it worked.
                  Again, just trying to know how can I reset form fields to blank value. I am using following code but it does not work.


                  <h:commandLink styleClass="medText" value="Reset" style="cursor:pointer">
                   <a4j:support event="onclick" reRender="panel"
                   onsubmit="if(!confirm('Are you sure to change the values?'))
                   {form.reset(); return false;}"
                   oncomplete="alert('Value succesfully reset')"/>
                   </h:commandLink>


                  Sorry for too much qs

                  • 6. Re: Problem using Richfaces.hideModalPanel
                    ilya_shaikovsky

                    form reset could not works for our rich components because it isn not just simple inputs and form has no idea about what should be reseted.. So you have two options:
                    1) manually reset our inputs like calendar or combo or inplace to the value you need.
                    2) use ajax request to clear the value bindings and reREder the inputs area.