Confirm Dialog
ConfirmationDialog is a replacement for the javascript confirm function. Skinning, customization, avoiding popup blockers are the notable features.
ConfirmationDialog is a replacement for the javascript confirm function. Skinning, customization, avoiding popup blockers are the notable features.
<h:form prependId="false">
<p:growl id="messages" />
<h:panelGrid columns="1" cellpadding="5">
<h:outputText id="msg" value="#{buttonBean.text}"/>
<p:commandButton id="showDialogButton" value="Destroy the World" onclick="confirmation.show()" type="button"/>
</h:panelGrid>
<p:confirmDialog id="confirmDialog" message="Are you sure about destroying the world?"
header="Initiating destroy process" severity="alert" widgetVar="confirmation">
<p:commandButton id="confirm" value="Yes Sure" update="messages" oncomplete="confirmation.hide()"
actionListener="#{buttonBean.destroyWorld}" />
<p:commandButton id="decline" value="Not Yet" onclick="confirmation.hide()" type="button" />
</p:confirmDialog>
</h:form>
package org.primefaces.examples.view;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
public class ButtonBean {
public void destroyWorld(ActionEvent actionEvent){
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "System Error", "Please try again later.");
FacesContext.getCurrentInstance().addMessage(null, message);
}
}
Running PrimeFaces-4.0-SNAPSHOT on Mojarra-2.1.22
