How to conditionally close a modal PopupPanel after Ajax submit
samnumber7 Jan 2, 2012 6:46 PMI 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...
{code}
<rich:popupPanel id="registrationPopup" autosized="true" resizeable="false">
<f:facet name="header">
<h:outputText value="Register" />
</f:facet>
<h:form id="registrationForm">
<h:panelGrid columns="3">
<h:outputLabel value="Email address" />
<h:inputText id="emailAddress"
value="#{registrationController.userAccount.emailAddress}"
required="true" />
<rich:message for="emailAddress" />
<h:outputLabel value="Password" />
<h:inputSecret id="password"
value="#{registrationController.userAccount.password}"
required="true" />
<rich:message for="password" />
<h:outputLabel value="Confirm Password" required="true" />
<h:inputSecret id="confirmPassword"
value="#{registrationController.userAccount.confirmPassword}"
required="true" />
<rich:message for="confirmPassword" />
<h:commandButton value="Cancel"
onclick="#{rich:component('registrationPopup')}.hide()" />
<a4j:commandButton value="Submit"
action="#{registrationController.createUserAccount}"
execute="@form" render="@form"/>
</h:panelGrid>
</h:form>
</rich:popupPanel>
{code}