• Settings
    • Locale
    • Change the locale of the datepicker, schedule and client side validation messages.

      Language
      English
      English
      English
      French
      German
      German
      German
      Italian
      Korean
      Spanish
      Catalan
      Dutch
      Portuguese
      Portuguese
      Arabic
      Arabic
      Bulgarian
      Bangla
      Bosnian
      Czech
      Greek
      Estonian
      Persian
      Finnish
      Danish
      Hindi
      Indonesian
      Icelandic
      Croatian
      Japanese
      Hungarian
      Hebrew
      Georgian
      Central Kurdish
      Khmer
      Kyrgyz
      Kazakh
      Lithuanian
      Latvian
      Malay
      Norwegian
      Polish
      Romanian
      Russian
      Slovak
      Slovenian
      Serbian
      Serbian
      Swedish
      Thai
      Turkish
      Ukrainian
      Uzbek
      Vietnamese
      Chinese
      Chinese
  • Resources

Confirm Dialog

ConfirmDialog is integrated with confirm behavior to implement confirmations with ease. ConfirmDialog has two modes; global and non-global. Non-Global mode is almost same as the dialog component used with a simple client side api, show() and hide().

ConfirmDialog Tag Documentation

ConfirmDialog is a dialog component used to display confirmation messages.

NameTypeRequiredDefaultDescription
id String false generated Unique identifier of the component in a namingContainer.
rendered boolean false true Boolean value to specify the rendering of the component, when set to false component will not be rendered.
binding UIComponent false generated An EL expression referring to a server side UIComponent instance in a backing bean.
widgetVar String false generated ('widget_' + componentClientId) Name of the client side widget.
appendTo String false @(body) Append dialog to the element with the given identifier.
closable boolean false true Makes dialog closable.
closeOnEscape boolean false false Closes dialog when escape key is pressed.
dir String false ltr Defines text direction, valid values are ltr and rtl.
dismissibleMask boolean false false Closes dialog by clicking on the modal background mask.
global boolean false false When enabled, confirmDialog becomes a shared for other components that require confirmation.
header String false Header text.
height String false Height of the dialog.
hideEffect String false Hide effect to be used when hiding dialog.
message String false Message text to display.
responsive boolean false false In responsive mode, dialog adjusts itself based on screen width.
severity String false alert Severity of the message, valid values are 'alert' and 'info'.
showEffect String false Show effect to be used when displaying dialog.
style String false Inline style of the component.
styleClass String false Style class of the component.
visible boolean false false Renders dialog as visible.
width String false Width of the dialog.
Loading...
Tag DocumentationNew DocumentationNew Documentation JSDoc

Global

Non-Global

Initiating destroy process
Are you sure about destroying the world?

Usage


<script>
function checkConfirmation() {
    console.log('ConfirmDialog BeforeShow!');
    return true; // return false to not bring up the dialog
}
</script>
<div class="card">
    <h3>Global</h3>
    <h:form>
        <p:growl id="message" showDetail="true"/>

        <p:commandButton value="Confirm" action="#{confirmView.confirm}" update="message" styleClass="mr-2"
                         icon="pi pi-check">
            <p:confirm header="Confirmation" message="Are you sure you want to proceed?" beforeShow="checkConfirmation();"
                       icon="pi pi-exclamation-triangle"/>
        </p:commandButton>

        <p:commandButton value="Delete" action="#{confirmView.delete}" update="message"
                         styleClass="ui-button-danger mr-2" icon="pi pi-times">
            <p:confirm header="Confirmation"
                       message="Do you want to delete this record?"
                       icon="pi pi-info-circle"
                       yesButtonLabel="Delete Me!"
                       yesButtonClass="bg-red-600 text-white"
                       yesButtonIcon="pi pi-trash"
                       noButtonLabel="Keep this!"
                       noButtonClass="bg-green-600 text-white"
                       noButtonIcon="pi pi-heart"/>
        </p:commandButton>

        <p:commandButton value="Non-Ajax" action="#{confirmView.nonAjax}" styleClass="ui-button-warning mr-2"
                         icon="pi pi-question" ajax="false">
            <p:confirm header="Confirmation" message="Submit this page and reload?"
                       icon="pi pi-question-circle"/>
        </p:commandButton>

        <p:commandButton value="Facet" action="#{confirmView.confirm}" update="message" icon="pi pi-check">
            <p:confirm header="Confirmation" icon="pi pi-exclamation-triangle" escape="false"/>
            <f:facet name="confirmMessage">
                Are you sure you want to proceed?
                <br/>
                Formatted content, with EL evaluation so 1 + 1 = #{1 + 1}.
            </f:facet>
        </p:commandButton>

        <p:confirmDialog global="true" showEffect="fade" hideEffect="fade" responsive="true" width="350">
            <p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no ui-button-flat"
                             icon="pi pi-times"/>
            <p:commandButton value="Yes" type="button" styleClass="ui-confirmdialog-yes" icon="pi pi-check"/>
        </p:confirmDialog>


        <h3>Non-Global</h3>
        <p:commandButton type="button" onclick="PF('cd').show()" value="Destroy World" icon="pi pi-trash"
                         styleClass="ui-button-danger mr-2"/>
        <p:confirmDialog message="Are you sure about destroying the world?" header="Initiating destroy process"
                         severity="alert" widgetVar="cd" dismissibleMask="true">
            <p:commandButton value="Yes Sure" action="#{confirmView.delete}" update="message"
                             oncomplete="PF('cd').hide()" styleClass="ui-button-danger"/>
            <p:commandButton value="Not Yet" onclick="PF('cd').hide();" type="button"/>
        </p:confirmDialog>
    </h:form>
</div>