Confirm Dialog

ConfirmationDialog is a replacement for the javascript confirm function. Skinning, customization, avoiding popup blockers are the notable features.

Initiating destroy process

Are you sure about destroying the world?

Source

<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>