I have a simple login page that displays a message if the login was not successful. I want this message to disappear after 5 seconds, but I cannot get it to work.
Part of the input (removed most of the unnecessary material):
<h:inputText title="Name" value="#{authBean.name}" id="username" />
<h:inputSecret title="Password" value="#{authBean.password}" id="password" />
<p:commandButton id="loginButton" action="#{authBean.loginAndRedirect}"
update="@form" value="Login" />
<h:message id="messages" for="login:username" />
What I have tried so far:
The command entered on the Firebug command line works fine: $('[id$=messages]').fadeOut();
Now I need to start it with a timer:
setting a callback on such a button does not work (no effect, no errors):
<p:commandButton ... oncomplete="setTimeout(5000, '$('[id$=messages]').fadeOut())" ... />
I tried it with onclickand oncomplete, but without effect and without errors.
Tried to use primfaces effects (jQuery wrapped effects) in an element message:
<h:message id="messages" for="login:username" errorClass="errorMessage">
<p:effect type="fadeout" event="load" delay="5000">
<f:param name="mode" value="'hide'" />
</p:effect>
</h:message>
no effect, no errors.
source
share