title: primefaces commandbutton oncomplete not fired
body: <p>I have the following code:</p>
  
  <p>xhtml:</p>
  
  <pre><code>&lt;ui:composition xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:p="http://primefaces.org/ui"
  template="/template.xhtml"&gt;
  &lt;ui:define name="content"&gt;
  
  &lt;h:form id="serviceForm"&gt;
  &lt;h3 class="title"&gt;Services&lt;/h3&gt;
  &lt;p:growl id="msg" showDetail="true" life="3000" autoUpdate="true"/&gt;
  
  &lt;h:panelGrid width="100%"&gt;
  .... some code....
  &lt;p:row&gt;
  &lt;p:column colspan="4"&gt; 
  &lt;p:dataTable id="search" var="service" value="#{bean.services}" editable="true"&gt; 
  &lt;p:ajax event="rowEdit" listener="#{bean.onEdit}" update=":serviceForm:msg" /&gt;
  &lt;p:ajax event="rowEditCancel" listener="#{bean.onCancel}" update=":serviceForm:msg" /&gt;    
  ... some rows that works fine  .....          
  &lt;/p:dataTable&gt;
  &lt;/p:column&gt;
  &lt;/p:row&gt;
  &lt;p:row&gt;
  &lt;p:column&gt;&amp;#160;&lt;/p:column&gt;
  &lt;/p:row&gt;
  &lt;p:row&gt;
  &lt;p:column&gt;
  &lt;h:form id="addForm"&gt;
  ... this call work perfectly ....
  &lt;p:commandButton id="btnAdd" value="New  Service" onclick="PF('add').show()" immediate="true"/&gt;
  
  &lt;p:dialog id="add" widgetVar="add" header="Add New Service" showEffect="clip" 
  hideEffect="explode" position="center,center" width="520" modal="true" closable="false"
  closeOnEscape="true" resizable="false" 
  &gt;
  &lt;h:panelGrid width="100%"&gt;
  &lt;p:row&gt;
  &lt;p:column&gt;
  &lt;h:outputLabel value="Cve Service" /&gt;
  &lt;/p:column&gt;
  &lt;/p:row&gt;
  ... some another fields that works ok ...
  &lt;p:row&gt;
  &lt;p:column&gt;
  .... HERE IS THE PROBLEM ON COMPLETE TO CLOSE DIALOG ITS NOT WORKING ...
  &lt;p:commandButton id="addServ" value="Adding" onComplete="PF('add').hide()"  actionListener="#{bean.add}"/&gt;
  .. this button its working fine
  &lt;p:commandButton immediate="true" id="cancela" value="Cancelar" onclick="PF('add').hide()" /&gt;
  &lt;p:growl id="msgAdd" showDetail="true" life="5000" autoUpdate="true"/&gt;
  &lt;/p:column&gt;
  &lt;/p:row&gt;
  &lt;/h:panelGrid&gt;
  &lt;/p:dialog&gt;
  &lt;/h:form&gt;
  &lt;/p:column&gt; 
  &lt;/p:row&gt;
  
  &lt;/h:panelGrid&gt;  
  &lt;/h:form&gt;
  &lt;/ui:define&gt;
  
  &lt;/ui:composition&gt;
  </code></pre>
  
  <p>backing bean:</p>
  
  <pre><code>@ManagedBean
  @ViewScoped
  @SuppressWarnings("serial")
  public class Bean implements Serializable{
  
  private ServiceRemote ejb;
  private Service addService;
  
  .... some code ok ....
  
  public void add(){
  
  if( addService.getId().getCve() == null || addService.getId().getCve().equals("") ){
  
  FacesContext.getCurrentInstance().addMessage( null, 
  new FacesMessage(FacesMessage.SEVERITY_ERROR, 
  "some title", 
  "some msg."));         
  
  }else{
  
  Service ser = ejb.findService("some" , "some another",  null);
  
  if(ser == null){
  ... some code to insert that works ok ..
  
  int result = ejb.insertService( this.addService );
  
  if(result &gt; 0)
  FacesContext.getCurrentInstance().addMessage( null, 
  new FacesMessage(FacesMessage.SEVERITY_WARN, 
  "some title", 
  "some msg"
  )
  );
  else
  FacesContext.getCurrentInstance().addMessage( null, 
  new FacesMessage(FacesMessage.SEVERITY_ERROR, 
  "some title", 
  "some text")
  );
  
  }else
  FacesContext.getCurrentInstance().addMessage( null, 
  new FacesMessage(FacesMessage.SEVERITY_WARN, 
  "some", 
  "some msg")
  );
  
  }
  
  }
  .... some getters y setters...
  }
  </code></pre>
  
  <p>The idea is that after performing the action the commandbutton close the dialog window that opened but does not actually put a simple alert to see if the onComplete event was firing but I its no working ... </p>
  
  <p>and I tried several things, what could be wrong? </p>
  
  <p>Thank you very much.</p>