1 Reply Latest reply on Aug 16, 2008 8:23 AM by Miguel Miguel

    a4j:commandButton oncomplete tag

    Miguel Miguel Newbie

      hii, i have a problem with oncompletetag of a4j:commandButton. Well this is the code.

      <body onload="MM_preloadImages('imagenes/btn1.jpg', 'imagenes/btn2.jpg'); Richfaces.showModalPanel('panel',{width:350, top:110})">
       <rich:modalPanel id="panel" width="350" height="200">
       <f:facet name="header">
       <h:outputText value="Ingreso al sistema"></h:outputText>
       <table border="0" width="300">
       <td>Usuario: </td>
       <td><h:inputText value="#{LoginListener._usuario}" styleClass="textbox" size="20" maxlength="20" /></td>
       <td>Password: </td>
       <td><h:inputSecret value="#{LoginListener._password}" styleClass="textbox" size="20" maxlength="20" /></td>
       <a4j:commandButton value="Ingresar" action="#{LoginListener.Autenticar}" oncomplete="if (document.getElementById('hasMessages').value=='true') Richfaces.hideModalPanel('panel');" id="btnIngresar" styleClass="boton">
       <td><h:outputText id="e12" value="#{LoginListener._autenticado}" /></td>
       <h:inputHidden id="hasMessages" value="#{LoginListener._autenticado}" />

      Well, i have a page that show a modelpanel when load. The modelpanel is for login function. When i press "Ingresar" in the modalpanel, the function "Autenticar" in the backend bean is called and the result of he login process is save in "_autenticado". The problem is that when the login is succefull, the modalpanel has to hide. Im verifing the login results in the tag "oncomplete" of the button "Ingresar".

      Well, i hope u can help me with this. See u.