O'Reilly logo

PrimeFaces Beginner's Guide by K. Siva Prasad Reddy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – client-side callbacks for onShow and onHide

Here we will demonstrate how to trigger JavaScript functions when dialog show and hide events happen. Perform the following steps:

  1. Create a Dialog component and two JavaScript functions to be called as callback functions for onShow and onHide events:
    <h:head> <script> function simpleDlgOnShowCallback() { alert('Simple Dialog displayed successfully'); } function simpleDlgOnHideCallback() { alert('Simple Dialog is closed successfully'); } </script> </h:head> <h:form> <p:commandButton value="ShowDialog" onclick="dlg1.show();" type="button" /> <p:commandButton value="HideDialog" onclick="dlg1.hide();" type="button" /> <p:dialog id="simpleDialog" header="Simple Dialog" widgetVar="dlg1" width="300" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required