JSF 2 - commandButton not doing action after getting rendered
===

Hey I've been struggling with this whole day, and I can't find the answer yet. So my problem is I have 2 forms in my xhtml page, the first one shows a primefaces datatable filled with data from my DB and the second one gets filled with data from the selected user to edit it. Problem is, the second form has 2 commandButtons but after I render it (via ajax call) the buttons don't seem to call the method in the action attribute. 

Here is my code to get it all clearer.

This is my first form in the xhtml page

    <h:form id="form" style="width:710px;">
        <p:dataTable id="dataTable" var="supervisor" value="#{tablaBean.modeloUsuario}"  
                                 paginator="true" rows="15" paginatorPosition="bottom" selection="#{tablaBean.usuarioSel}"
                                 paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {NextPageLink} {LastPageLink}"
                                 rendered="#{tablaBean.showAll}">  
                        <f:facet name="header">  
                            <h:outputText value="Supervisores" />
                        </f:facet>  
                        <p:column  selectionMode="single" style="width:18px" />
                        <p:column headerText="Id" filterBy="#{supervisor.idUsuario}" filterStyle="width:35px;">  
                            <h:outputText value="#{supervisor.idUsuario}" />  
                        </p:column>   
                        <p:column headerText="Nombre" filterBy="#{supervisor.nombre}" id="nombreh">  
                            <h:outputText value="#{supervisor.nombre}" />  
                        </p:column>   
                        <p:column headerText="Ap. Paterno" filterBy="#{supervisor.apaterno}" id="apat">  
                            <h:outputText value="#{supervisor.apaterno}" />  
                        </p:column>   
                        <p:column headerText="Ap. Materno" filterBy="#{supervisor.amaterno}" id="amat">  
                            <h:outputText value="#{supervisor.amaterno}" />  
                        </p:column>   
                        <p:column headerText="Usuario" filterBy="#{supervisor.nombreUsuario}" id="user">  
                            <h:outputText value="#{supervisor.nombreUsuario}" />  
                        </p:column>    
                        <p:column headerText="Depto." filterBy="#{supervisor.departamento.nombre}" id="deptoh">  
                            <h:outputText value="#{supervisor.departamento.nombre}" />  
                        </p:column>
                        <f:facet name="footer">
                            <p:commandButton id="ver" value="Ver" icon="ui-icon-search" update=":form:userData" oncomplete="user.show()" />
                            <p:commandButton id="editar" value="Editar" icon="ui-icon-pencil" update=":form,:formEdit" action="#{tablaBean.edit()}" />
                        </f:facet>
                    </p:dataTable>
                </h:form>

This is the code from my second form

    <h:form id="formEdit">
    <p:growl />
    <p:fieldset legend="Editar Usuario" style="margin: auto;">
        <h:panelGrid columns="3">
            <h:outputText value="Id" />
            <h:outputText value="#{tablaBean.usuarioSel.idUsuario}" id="id" />
            <p:message for="id" />
            <p:outputLabel for="nombre" value="Nombre" />
            <p:inplace>
                <p:inputText value="#{tablaBean.usuarioSel.nombre}" id="nombre" required="true" />
            </p:inplace>
            <p:message for="nombre" />
            <p:outputLabel for="appat" value="Apellido Paterno" />
            <p:inplace>
                <p:inputText value="#{tablaBean.usuarioSel.apaterno}" id="appat" required="true"/> 
            </p:inplace>
            <p:message for="appat" />
            <p:outputLabel for="apmat" value="Apellido Materno" />
            <p:inplace>
                <p:inputText value="#{tablaBean.usuarioSel.amaterno}" id="apmat" required="true"/> 
            </p:inplace>
            <p:message for="apmat" />
            <p:outputLabel for="usuario" value="Usuario" />
            <p:inplace>
                <p:inputText value="#{tablaBean.usuarioSel.nombreUsuario}" id="usuario" required="true"> 
                    <f:ajax render="msgUsuario" event="blur" />
                    <f:validator binding="#{userNameValidator}" />
                </p:inputText>
            </p:inplace>
            <p:message for="usuario" id="msgUsuario" />
            <p:outputLabel for="depto" value="Departamento" />
            <p:inplace>
                <p:inputText value="#{tablaBean.usuarioSel.departamento.nombre}" id="depto" required="true" /> 
            </p:inplace>
            <p:message for="depto" />
        </h:panelGrid>
        <p:commandButton value="Guardar" icon="ui-icon-disk" action="#{tablaBean.editarUsuario()}" />
        <p:commandButton id="editar" value="Cancelar" update=":form,:formEdit" icon="ui-icon-pencil" action="#{tablaBean.edit()}" />
    </p:fieldset>
</h:form>

So when I call the method "edit()" I change the showAll variable's value so it renders the second form and "hide" the first one. Problem is after I do that the command buttons in the second form do nothing. (Don't even enter the method)

Here's my bean

        @Named(value = "tablaBean")
        @ConversationScoped
    
    public class TablaBean implements Serializable {
    
        @Inject
        private UsuariosDao usuario;
        @Inject
        private Usuarios usuarioSel;
        @Inject
        private Conversation conversation;
        private UserDataModel modeloUsuario;
        private boolean showAll;
    
        /**
         * Creates a new instance of TablaBean
         */
        public TablaBean() {
        }
    
        @PostConstruct
        public void init() {
            start();
            modeloUsuario = new UserDataModel(usuario.findSupers());
            showAll = true;
        }
        
        public void start(){
            conversation.begin();
        }
        
        public void end(){
            conversation.end();
        }
    
        public Usuarios getUsuarioSel() {
            return usuarioSel;
        }
    
        public void setUsuarioSel(Usuarios usuarioSel) {
            this.usuarioSel = usuarioSel;
        }
    
        public UserDataModel getModeloUsuario() {
            return modeloUsuario;
        }
    
        public boolean isShowAll() {
            return showAll;
        }
    
        public void setShowAll(boolean showAll) {
            this.showAll = showAll;
        }
    
        public UsuariosDao getUsuario() {
            return usuario;
        }
    
        public void setUsuario(UsuariosDao usuario) {
            this.usuario = usuario;
        }
    
        public String edit() {
            System.out.println("holis");
            showAll = !showAll;
            return "";
        }
        
        public String editarUsuario(){
            System.out.println("hola");
            end();
            return "";
        }
    }

Any advice on what I might be doing wrong is appreciated, thanks in advance.


 