1 Reply Latest reply on Jan 2, 2012 8:04 PM by Tim Orme

    How to conditionally close a modal PopupPanel after Ajax submit

    Tim Orme Newbie

      I have a modal popupPanel that I want to close after an Ajax submit, if there are no validation errors. With the code below, validation error message display properly on invalid input, but I can't figure out what to add to make the popupPanel close if validation passes. (As the code stands now, clicking submit with valid data results in no visual response, although the backing bean is receiving values). I've tried a number of different things... setting the onclick event to hide the popupPanel of course closes it even on invalid input...



      <rich:popupPanel id="registrationPopup" autosized="true" resizeable="false">



                                              <f:facet name="header">

                                                        <h:outputText value="Register" />




                                              <h:form id="registrationForm">



                                                        <h:panelGrid columns="3">

                                                                  <h:outputLabel value="Email address" />

                                                                  <h:inputText id="emailAddress"


                                                                            required="true" />

                                                                  <rich:message for="emailAddress" />


                                                                  <h:outputLabel value="Password" />

                                                                  <h:inputSecret id="password"


                                                                            required="true" />

                                                                  <rich:message for="password" />



                                                                  <h:outputLabel value="Confirm Password" required="true" />

                                                                  <h:inputSecret id="confirmPassword"


                                                                            required="true" />

                                                                  <rich:message for="confirmPassword" />


                                                                  <h:commandButton value="Cancel"

                                                                            onclick="#{rich:component('registrationPopup')}.hide()" />

                                                                  <a4j:commandButton value="Submit"


                                                                            execute="@form" render="@form"/>










        • 1. Re: How to conditionally close a modal PopupPanel after Ajax submit
          Tim Orme Newbie

          found that setting up the commandButton as follows does the trick


          <a4j:commandButton value="Submit"


                                                                                execute="@form" render="@form"