I use a rich:popupPanel component, which displays the input fields for the login. I need to close the popup when the login was successful, but just then. When the user types in a wrong password, I display a message and the popup panel should rest open. If I make a page reload, all welcome messages and other stuff will disappear.
I've got a javascript which closes my popup: onclick="RichFaces.$('popup_login').hide()"
How can I run the script only when the action method returns "1" (e.g.) ?
<h:form id="loginForm">
<h:inputText id="email" value="#{loginBean.email}" />
<a4j:commandLink id="submit" action="#{loginBean.doLogin}" onclick="RichFaces.$('popup_login').hide()">
<h:outputText value="login" />
</a4j:commandLink>
</h:form>
Check in the oncomplete
if validation has not failed.
<a4j:commandLink ... oncomplete="if (#{!facesContext.validationFailed}) RichFaces.$('popup_login').hide()">