Reputation: 767
I want to show a dialog only three seconds and after close it automatically and redirect an other faces page. How can I do it?
Thanks in Advance.
The dialog:
<p:dialog id="dialog" header="Message" widgetVar="dlg1">
<h:outputText value="your account is being blocked......" />
</p:dialog>
Upvotes: 2
Views: 5495
Reputation: 4189
Dialog has two attributes onShow
and onHide
(you can reference in Primefaces doc), and you can use timeout to do it, you can try:
<p:dialog widgetVar="dlg1" onShow="myFunction();" onHide="myStopFunction();"> </p:dialog>
<script>
var myVar;
function myFunction()
{
myVar=setTimeout(function(){ dlg1.hide()},3000);
}
function myStopFunction()
{
clearTimeout(myVar);
}
</script>
Upvotes: 3