title: multiple dialogs in primefaces
body: <p>I have a table with two dialogs, one to delete and other to add new accounts.
  When I click on both buttons allways one dialog is displayed.
  What I am doing wrong?
  Here is my front end the code</p>
  
  <pre><code>&lt;ui:composition template="/WEB-INF/templates/default.xhtml"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:h="http://java.sun.com/jsf/html"&gt;
  
  &lt;ui:param name="hideHeaderAndFooter" value="false" /&gt;
  &lt;ui:param name="navigationAndMain" value="false" /&gt;
  &lt;ui:param name="login" value="false" /&gt;
  
  &lt;ui:define name="mainContent"&gt;
      &lt;div xmlns="http://www.w3.org/1999/xhtml"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:p="http://primefaces.org/ui"&gt;
          &lt;h:form id="form"&gt;
              &lt;p:growl id="messages" showDetail="true" /&gt;
              &lt;p:growl id="growl" showDetail="true" /&gt;
              &lt;p:growl id="messageyesno" /&gt;
              &lt;p:growl id="messageadd" /&gt;
  
              &lt;p:dataTable var="account"
                  value="#{accountManagedBeanTran.accountDataModel}"
                  sortMode="multiple" paginator="true" rows="10"
                  paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                  rowsPerPageTemplate="5,10,15" editable="true"
                  resizableColumns="true" draggableColumns="true"
                  selection="#{accountManagedBeanTran.selectedAccounts}"&gt;
  
                  &lt;f:facet name="header"&gt;List of Users&lt;/f:facet&gt;
  
                  &lt;p:ajax event="rowEdit" listener="#{accountManagedBeanTran.onEdit}"
                      update=":form:messages"&gt;&lt;/p:ajax&gt;
                  &lt;p:ajax event="rowEditCancel"
                      listener="#{accountManagedBeanTran.onCancel}"
                      update=":form:messages"&gt;&lt;/p:ajax&gt;
                  &lt;p:ajax event="colResize" update=":form:growl"
                      listener="#{accountManagedBeanTran.onResize}"&gt;&lt;/p:ajax&gt;
  
                  &lt;p:column selectionMode="multiple" style="width:2%" /&gt;
  
                  &lt;p:column sortBy="#{account.username}" headerText="User Name"
                      filterBy="#{account.username}" filterMatchMode="contains"
                      style="width:30%"&gt;
  
                      &lt;p:cellEditor&gt;
                          &lt;f:facet name="output"&gt;
                              &lt;h:outputText value="#{account.username}" /&gt;
                          &lt;/f:facet&gt;
                          &lt;f:facet name="input"&gt;
                              &lt;p:inputText value="#{account.username}" style="width:100%" /&gt;
                          &lt;/f:facet&gt;
                      &lt;/p:cellEditor&gt;
  
                  &lt;/p:column&gt;
  
                  &lt;p:column sortBy="#{account.firstName}" headerText="First Name"
                      filterBy="#{account.firstName}" filterMatchMode="contains"
                      style="width:20%"&gt;
                      &lt;p:cellEditor&gt;
                          &lt;f:facet name="output"&gt;
                              &lt;h:outputText value="#{account.firstName}" /&gt;
                          &lt;/f:facet&gt;
                          &lt;f:facet name="input"&gt;
                              &lt;p:inputText value="#{account.firstName}" style="width:100%"
                                  label="First Name" /&gt;
                          &lt;/f:facet&gt;
                      &lt;/p:cellEditor&gt;
                  &lt;/p:column&gt;
  
                  &lt;p:column sortBy="#{account.lastName}" headerText="Surname"
                      filterBy="#{account.lastName}" filterMatchMode="contains"&gt;
                      &lt;p:cellEditor&gt;
                          &lt;f:facet name="output"&gt;
                              &lt;h:outputText value="#{account.lastName}" /&gt;
                          &lt;/f:facet&gt;
                          &lt;f:facet name="input"&gt;
                              &lt;p:inputText value="#{account.lastName}" style="width:100%"
                                  label="Last Name" /&gt;
                          &lt;/f:facet&gt;
                      &lt;/p:cellEditor&gt;
                  &lt;/p:column&gt;
  
                  &lt;p:column sortBy="#{account.email}" headerText="Email"
                      filterBy="#{account.email}" filterMatchMode="contains"&gt;
                      &lt;p:cellEditor&gt;
                          &lt;f:facet name="output"&gt;
                              &lt;h:outputText value="#{account.email}" /&gt;
                          &lt;/f:facet&gt;
                          &lt;f:facet name="input"&gt;
                              &lt;p:inputText value="#{account.email}" style="width:100%"
                                  label="Email" /&gt;
                          &lt;/f:facet&gt;
                      &lt;/p:cellEditor&gt;
                  &lt;/p:column&gt;
  
                  &lt;p:column style="width:6%"&gt;
                      &lt;p:rowEditor /&gt;
                  &lt;/p:column&gt;
  
                  &lt;f:facet name="footer"&gt;
  
                      &lt;div&gt;
  
                          &lt;p:commandButton id="delete" value="Delete"
                              onclick="confirmation.show()" type="button" /&gt;
  
                          &lt;p:confirmDialog id="deleteConfirmDialog" message="Queres borrar el usuario?"
                              showEffect="drop" hideEffect="drop"
                              header="Delete" severity="alert"
                              widgetVar="confirmation" modal="true"&gt;
  
                              &lt;p:commandButton value="Yes" update=":form:messageyesno"
                                  oncomplete="confirmation.hide()"
                                  actionListener="#{accountManagedBeanTran.onDelete}" /&gt;
                              &lt;p:commandButton value="Not" onclick="confirmation.hide()"
                                  type="button" /&gt;
  
                          &lt;/p:confirmDialog&gt;
  
                          &lt;p:commandButton id="add" value="Add"
                              onclick="confirmation.show()" type="button" /&gt;
  
                          &lt;p:confirmDialog id="addConfirmDialog" message="Queres agregar un usuario?"
                              showEffect="drop" hideEffect="drop"
                              header="Add" severity="alert"
                              widgetVar="confirmation" modal="true"&gt;
  
                              &lt;h:form id="messageAddForm"&gt;
                                  &lt;h:panelGrid columns="2" style="margin-bottom:10px"&gt;
                                      &lt;h:outputLabel for="username" value="User Name:" /&gt;
                                      &lt;p:inputText id="unsername" value="#{accountManagedBeanTran.newAccount.username}" /&gt;
                                      &lt;h:outputLabel for="password" value="Password:" /&gt;
                                      &lt;p:inputText id="password" value="#{accountManagedBeanTran.newAccount.password}" /&gt;
                                      &lt;h:outputLabel for="firstName" value="First Name" /&gt;
                                      &lt;p:inputText id="firstName" value="#{accountManagedBeanTran.newAccount.firstName}" /&gt;
                                      &lt;h:outputLabel for="lastName" value="Surname" /&gt;
                                      &lt;p:inputText id="lastName" value="#{accountManagedBeanTran.newAccount.lastName}" /&gt;
                                      &lt;h:outputLabel for="email" value="Email" /&gt;
                                      &lt;p:inputText id="email" value="#{accountManagedBeanTran.newAccount.email}" /&gt;
                                      &lt;h:outputText value="Enabled:" /&gt;  
                                      &lt;p:selectBooleanCheckbox value="#{accountManagedBeanTran.newAccount.enabled}" /&gt;            
                                  &lt;/h:panelGrid&gt;  
                              &lt;/h:form&gt;
  
                              &lt;p:commandButton value="Save" update=":form:messageadd"
                                  oncomplete="confirmation.hide()"
                                  actionListener="#{accountManagedBeanTran.onCreate}" /&gt;
                              &lt;p:commandButton value="Cancel" onclick="confirmation.hide()"
                                  type="button" /&gt;
  
                          &lt;/p:confirmDialog&gt;
                                          &lt;/div&gt;
  
                  &lt;/f:facet&gt;
  
              &lt;/p:dataTable&gt;
          &lt;/h:form&gt;
      &lt;/div&gt;
  &lt;/ui:define&gt;
  </code></pre>
  
  <p></p>
  
  <p>Thanks in advance.</p>