Primefaces : Confirmation dialog with javascript

It works in the situation that you want to ask something for user before really do it. For example, we can think about the situation when the user will delete all clients. It’s better ask him before do that, like as “Are you sure?”.

<h:commandLink onclick="if (! confirm('Are you sure?)) return false"
               action="#{myController.removeAllClients()}">
    <i class="glyphicon glyphicon-check"></i> Remove All Clients
</h:commandLink>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s