2 Replies Latest reply on Feb 21, 2010 2:31 PM by Guilherme Almeida

    a4j commandButton in a modal Panel end conversation

    Fernando Hernandez Newbie

      I have a a4j command button inside rich Modal Panel and when I click on it the seam conversation is ended and the browser switch to the main page.
      The code is:



              <h:form styleClass="main">
                      <rich:separator width="0" height="15"></rich:separator>
              <h:messages globalOnly="true" styleClass="message" id="globalMessages"/>
              <rich:separator width="0" height="15"></rich:separator>
             
                              <h:panelGrid columns="6"
                                      columnClasses="nameAcceso, valueAcceso, nameAcceso, valueAcceso, nameAcceso, valueAcceso"
                                      cellspacing="5px" headerClass="headerDeviceData">
                                      <f:facet name="header">
                                              <h:outputText value="#{messages.deviceData}"/>
                                      </f:facet>
                                      <h:outputText value="${messages.addressIP}:" />
                                      <h:outputText value="#{deviceinformation.host}" />
                                      <h:outputText value="${messages.mnemonico}:" />
                                      <h:outputText value="#{deviceinformation.ficha.mnemotecnicoFichas}" />
                                      <h:outputText value="${messages.model}:" />
                                      <h:outputText value="#{deviceinformation.model}" />
                                      <h:outputText
                                              value="#{deviceinformation.datos_empresa.textoCat1Empresa}:" />
                                      <h:outputText value="#{deviceinformation.ficha.nombreCat1Fichas}" />
                                      <h:outputText value="#{deviceinformation.datos_empresa.usuario1}:" />
                                      <h:outputText value="#{deviceinformation.ficha.usuario1Fichas}" />
                                      <h:outputText value="${messages.firmware}:" />
                                      <h:outputText value="#{deviceinformation.firmware}" />
                                      <h:outputText
                                              value="#{deviceinformation.datos_empresa.textoCat2Empresa}:" />
                                      <h:outputText value="#{deviceinformation.ficha.nombreCat2Fichas}" />
                                      <h:outputText value="#{deviceinformation.datos_empresa.usuario2}:" />
                                      <h:outputText value="#{deviceinformation.ficha.usuario2Fichas}" />
                                      <h:outputText value="${messages.serialNumber}:" />
                                      <h:outputText value="#{deviceinformation.serial_number}" />
                                      <h:outputText value="" />
                                      <h:outputText value="" />
                                      <h:outputText value="" />
                                      <h:outputText value="" />
                                      <h:outputText value="${messages.date_device}:" />
                                      <h:outputText value="#{deviceinformation.date_device}" id="fechaEquipo">
                                              <s:convertDateTime type="both" dateStyle="short" timeStyle="medium"/>
                                      </h:outputText>
                              </h:panelGrid>
                      <rich:separator width="0" height="30"></rich:separator>
                      <s:div styleClass="panelButtons">
              <h:panelGrid columns="3" width="100%" columnClasses="deleteButton, deleteButton, deleteButton">                  
                              <a4j:commandButton styleClass="boton"
                              onclick="javascript:Richfaces.showModalPanel('reload',{width:450, top:200})"
                              onmouseover="this.style.backgroundColor='green';this.style.color='white';this.style.cursor='pointer'"
                              onmouseout="this.style.backgroundColor='';this.style.color='';this.style.cursor=''"
                              id="link1" value="#{messages.reload}"
                              title="#{messages.reload}"><s:conversationPropagation type="join"/></a4j:commandButton>
                              <a4j:commandButton styleClass="boton"
                              onclick="javascript:Richfaces.showModalPanel('restart',{width:450, top:200})"
                              onmouseover="this.style.backgroundColor='green';this.style.color='white';this.style.cursor='pointer'"
                      onmouseout="this.style.backgroundColor='';this.style.color='';this.style.cursor=''"
                              id="link2" value="#{messages.restart}"
                              title="#{messages.restart}"><s:conversationPropagation type="join"/></a4j:commandButton>
                              <s:button styleClass="boton"
                              onmouseover="this.style.backgroundColor='green';this.style.color='white';this.style.cursor='pointer'"
                      onmouseout="this.style.backgroundColor='';this.style.color='';this.style.cursor=''"
                              id="link3" value="#{messages.dateUpdate}"
                              action="#{deviceinformation.sincronizaEquipo(true)}"
                              title="#{messages.dateUpdate}">
                              </s:button>
                      </h:panelGrid>
              </s:div>
              <s:div styleClass="panelButtons">
              <h:panelGrid columns="3" width="100%" columnClasses="deleteButton, deleteButton, deleteButton">        
                              <s:button styleClass="boton"
                      onmouseover="this.style.backgroundColor='green';this.style.color='white';this.style.cursor='pointer'"
                      onmouseout="this.style.backgroundColor='';this.style.color='';this.style.cursor=''"
                      id="link0" value="#{messages.getconfiguration}"
                              action="#{deviceconfiguration.recibirConf(deviceinformation.equipo.direccionaccesoEquipos, deviceinformation.equipo.usuarioFtp, deviceinformation.equipo.facilidadesEquipos, 0, deviceinformation.ficha.codFichas)}"
                              title="#{messages.getconfiguration}" disabled="#{s:hasRole('Visualizador')}"></s:button>
                              <s:button styleClass="boton"
                      onmouseover="this.style.backgroundColor='green';this.style.color='white';this.style.cursor='pointer'"
                      onmouseout="this.style.backgroundColor='';this.style.color='';this.style.cursor=''"
                      id="setconf" value="#{messages.setconfiguration}"
                              action="#{deviceconfiguration.enviarConf(deviceinformation.equipo.direccionaccesoEquipos, deviceinformation.equipo.usuarioFtp, deviceinformation.equipo.facilidadesEquipos, 0, deviceinformation.ficha.codFichas)}"
                              title="#{messages.setconfiguration}" disabled="#{s:hasRole('Visualizador')}"></s:button>
                              <s:button styleClass="boton"
                      onmouseover="this.style.backgroundColor='green';this.style.color='white';this.style.cursor='pointer'"
                      onmouseout="this.style.backgroundColor='';this.style.color='';this.style.cursor=''"
                      id="link5" value="${messages.configurations}"
                              action="#{configuracionesList.setFicha(deviceinformation.getFicha())}"
                              title="${messages.configurations}"></s:button>
              </h:panelGrid>
              </s:div>
              <div class="panelButtons">
              <h:panelGrid columns="2" width="100%" columnClasses="deleteButton, deleteButton">        
                              <s:button styleClass="boton"
                      onmouseover="this.style.backgroundColor='green';this.style.color='white';this.style.cursor='pointer'"
                      onmouseout="this.style.backgroundColor='';this.style.color='';this.style.cursor=''"
                      id="link4" value="#{messages.refresh}"
                              action="#{deviceinformation.refresca()}"
                              title="#{messages.refresh}"></s:button>
                              <s:button id="done" styleClass="boton"
                      value="#{messages.actionDone}"
                      propagation="none"
                      view="/#{empty accessFrom ? 'FichasList' : accessFrom}.xhtml"
                      onmouseover="this.style.backgroundColor='green';this.style.color='white';this.style.cursor='pointer'"
                      onmouseout="this.style.backgroundColor='';this.style.color='';this.style.cursor=''"
                      title="#{messages.actionDone}"/>
                  </h:panelGrid>
              </div>
          </h:form>
      <rich:modalPanel id="reload" height="130" top="200" left="300"
                                width="500" zindex="2000" resizeable="false" autosized="true">
                      <f:facet name="header">
                              <h:outputText value="${messages.confirmReload}" />
                      </f:facet>
                      <f:facet name="controls">
                              <h:graphicImage value="/img/close.png" style="cursor:pointer"
                                      onclick="Richfaces.hideModalPanel('reload')" />
                      </f:facet>
                      <s:div styleClass="sureDelete">
                              <p>${messages.questionReload}<br/>${messages.questionRestartReloadInfo}</p>
                      </s:div>         
                      <h:form>
                              <h:panelGrid columns="2" styleClass="panelModalPanel" columnClasses="columnLeftModalPanel,columnRightModalPanel">
                                     
                                      <h:commandButton styleClass="boton" id="accept" value="${messages.actionAccept}"
                                  onmouseover="this.style.backgroundColor='green';this.style.color='white';this.style.cursor='pointer'"
                                  onmouseout="this.style.backgroundColor='';this.style.color='';this.style.cursor=''"
                                  action="#{deviceinformation.recargarEquipo()}"/>
                                 
                                      <a4j:commandButton styleClass="boton" id="cancel" value="${messages.actionCancel}"
                                      onclick="javascript:Richfaces.hideModalPanel('reload')"
                                      onmouseover="this.style.backgroundColor='green';this.style.color='white';this.style.cursor='pointer'"
                                      onmouseout="this.style.backgroundColor='';this.style.color='';this.style.cursor=''">
                     
                                      </a4j:commandButton>
                              </h:panelGrid>
                      </h:form>
              </rich:modalPanel>
             
              <rich:modalPanel id="restart" height="130" top="200" left="300"
                                width="500" zindex="2000" resizeable="false" autosized="true">
                      <f:facet name="header">
                              <h:outputText value="${messages.confirmRestart}" />
                      </f:facet>
                      <f:facet name="controls">
                              <h:graphicImage value="/img/close.png" style="cursor:pointer"
                                      onclick="Richfaces.hideModalPanel('restart')" />
                      </f:facet>
                      <s:div styleClass="sureDelete">
                              <p>${messages.questionRestart}<br/>${messages.questionRestartReloadInfo}</p>
                      </s:div>         
                      <h:form>
                              <h:panelGrid columns="2" styleClass="panelModalPanel" columnClasses="columnLeftModalPanel,columnRightModalPanel">
                                      <h:commandButton styleClass="boton" id="accept" value="${messages.actionAccept}"
                                  onmouseover="this.style.backgroundColor='green';this.style.color='white';this.style.cursor='pointer'"
                                  onmouseout="this.style.backgroundColor='';this.style.color='';this.style.cursor=''"
                                  action="#{deviceinformation.reinicioEquipo()}"/>
                            
                                      <a4j:commandButton styleClass="boton" id="cancel" value="${messages.actionCancel}"
                                      onclick="javascript:Richfaces.hideModalPanel('restart')"
                                      onmouseover="this.style.backgroundColor='green';this.style.color='white';this.style.cursor='pointer'"
                                      onmouseout="this.style.backgroundColor='';this.style.color='';this.style.cursor=''">
                                     
                                      </a4j:commandButton>
                              </h:panelGrid>
                      </h:form>
              </rich:modalPanel>
             

           


      what is the mistake?
      Thanks

        • 1. Re: a4j commandButton in a modal Panel end conversation
          Fernando Hernandez Newbie
          I will try to format the code:
          <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                                       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


          <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                          xmlns:s="http://jboss.com/products/seam/taglib"
                          xmlns:ui="http://java.sun.com/jsf/facelets"
                          xmlns:f="http://java.sun.com/jsf/core"
                          xmlns:h="http://java.sun.com/jsf/html"
                              xmlns:rich="http://richfaces.org/rich"
                              xmlns:a4j="http://richfaces.org/a4j"
                          template="layout/template.xhtml">

          <ui:define name="body">
               <h:form styleClass="main">
                    <rich:separator width="0" height="15"></rich:separator>
                   <h:messages globalOnly="true" styleClass="message" id="globalMessages"/>
                   <rich:separator width="0" height="15"></rich:separator>
                   
                         <h:panelGrid columns="6"
                              columnClasses="nameAcceso, valueAcceso, nameAcceso, valueAcceso, nameAcceso, valueAcceso"
                              cellspacing="5px" headerClass="headerDeviceData">
                              <f:facet name="header">
                                   <h:outputText value="#{messages.deviceData}"/>
                              </f:facet>
                              <h:outputText value="${messages.addressIP}:" />
                              <h:outputText value="#{deviceinformation.host}" />
                              <h:outputText value="${messages.mnemonico}:" />
                              <h:outputText value="#{deviceinformation.ficha.mnemotecnicoFichas}" />
                              <h:outputText value="${messages.model}:" />
                              <h:outputText value="#{deviceinformation.model}" />
                              <h:outputText
                                   value="#{deviceinformation.datos_empresa.textoCat1Empresa}:" />
                              <h:outputText value="#{deviceinformation.ficha.nombreCat1Fichas}" />
                              <h:outputText value="#{deviceinformation.datos_empresa.usuario1}:" />
                              <h:outputText value="#{deviceinformation.ficha.usuario1Fichas}" />
                              <h:outputText value="${messages.firmware}:" />
                              <h:outputText value="#{deviceinformation.firmware}" />
                              <h:outputText
                                   value="#{deviceinformation.datos_empresa.textoCat2Empresa}:" />
                              <h:outputText value="#{deviceinformation.ficha.nombreCat2Fichas}" />
                              <h:outputText value="#{deviceinformation.datos_empresa.usuario2}:" />
                              <h:outputText value="#{deviceinformation.ficha.usuario2Fichas}" />
                              <h:outputText value="${messages.serialNumber}:" />
                              <h:outputText value="#{deviceinformation.serial_number}" />
                              <h:outputText value="" />
                              <h:outputText value="" />
                              <h:outputText value="" />
                              <h:outputText value="" />
                              <h:outputText value="${messages.date_device}:" />
                              <h:outputText value="#{deviceinformation.date_device}" id="fechaEquipo">
                                   <s:convertDateTime type="both" dateStyle="short" timeStyle="medium"/>
                              </h:outputText>
                         </h:panelGrid>
                    <rich:separator width="0" height="30"></rich:separator>
                    <s:div styleClass="panelButtons">
                   <h:panelGrid columns="3" width="100%" columnClasses="deleteButton, deleteButton, deleteButton">                    
                         <a4j:commandButton styleClass="boton"
                         onclick="javascript:Richfaces.showModalPanel('reload',{width:450, top:200})"
                         onmouseover="this.style.backgroundColor='green';this.style.color='white';this.style.cursor='pointer'"
                         onmouseout="this.style.backgroundColor='';this.style.color='';this.style.cursor=''"
                         id="link1" value="#{messages.reload}"
                         title="#{messages.reload}"><s:conversationPropagation type="join"/></a4j:commandButton>
                         <a4j:commandButton styleClass="boton"
                         onclick="javascript:Richfaces.showModalPanel('restart',{width:450, top:200})"
                         onmouseover="this.style.backgroundColor='green';this.style.color='white';this.style.cursor='pointer'"
                        onmouseout="this.style.backgroundColor='';this.style.color='';this.style.cursor=''"
                         id="link2" value="#{messages.restart}"
                         title="#{messages.restart}"><s:conversationPropagation type="join"/></a4j:commandButton>
                         <s:button styleClass="boton"
                         onmouseover="this.style.backgroundColor='green';this.style.color='white';this.style.cursor='pointer'"
                        onmouseout="this.style.backgroundColor='';this.style.color='';this.style.cursor=''"
                         id="link3" value="#{messages.dateUpdate}"
                         action="#{deviceinformation.sincronizaEquipo(true)}"
                         title="#{messages.dateUpdate}">
                         </s:button>
                    </h:panelGrid>
                   </s:div>
                   <s:div styleClass="panelButtons">
                   <h:panelGrid columns="3" width="100%" columnClasses="deleteButton, deleteButton, deleteButton">        
                         <s:button styleClass="boton"
                       onmouseover="this.style.backgroundColor='green';this.style.color='white';this.style.cursor='pointer'"
                        onmouseout="this.style.backgroundColor='';this.style.color='';this.style.cursor=''"
                       id="link0" value="#{messages.getconfiguration}"
                         action="#{deviceconfiguration.recibirConf(deviceinformation.equipo.direccionaccesoEquipos, deviceinformation.equipo.usuarioFtp, deviceinformation.equipo.facilidadesEquipos, 0, deviceinformation.ficha.codFichas)}"
                         title="#{messages.getconfiguration}" disabled="#{s:hasRole('Visualizador')}"></s:button>
                         <s:button styleClass="boton"
                       onmouseover="this.style.backgroundColor='green';this.style.color='white';this.style.cursor='pointer'"
                        onmouseout="this.style.backgroundColor='';this.style.color='';this.style.cursor=''"
                       id="setconf" value="#{messages.setconfiguration}"
                         action="#{deviceconfiguration.enviarConf(deviceinformation.equipo.direccionaccesoEquipos, deviceinformation.equipo.usuarioFtp, deviceinformation.equipo.facilidadesEquipos, 0, deviceinformation.ficha.codFichas)}"
                         title="#{messages.setconfiguration}" disabled="#{s:hasRole('Visualizador')}"></s:button>
                         <s:button styleClass="boton"
                       onmouseover="this.style.backgroundColor='green';this.style.color='white';this.style.cursor='pointer'"
                        onmouseout="this.style.backgroundColor='';this.style.color='';this.style.cursor=''"
                       id="link5" value="${messages.configurations}"
                         action="#{configuracionesList.setFicha(deviceinformation.getFicha())}"
                         title="${messages.configurations}"></s:button>
                   </h:panelGrid>
                   </s:div>
                   <div class="panelButtons">
                   <h:panelGrid columns="2" width="100%" columnClasses="deleteButton, deleteButton">      
                         <s:button styleClass="boton"
                       onmouseover="this.style.backgroundColor='green';this.style.color='white';this.style.cursor='pointer'"
                        onmouseout="this.style.backgroundColor='';this.style.color='';this.style.cursor=''"
                       id="link4" value="#{messages.refresh}"
                         action="#{deviceinformation.refresca()}"
                         title="#{messages.refresh}"></s:button>
                         <s:button id="done" styleClass="boton"
                        value="#{messages.actionDone}"
                        propagation="none"
                        view="/#{empty accessFrom ? 'FichasList' : accessFrom}.xhtml"
                        onmouseover="this.style.backgroundColor='green';this.style.color='white';this.style.cursor='pointer'"
                        onmouseout="this.style.backgroundColor='';this.style.color='';this.style.cursor=''"
                        title="#{messages.actionDone}"/>
                   </h:panelGrid>
                   </div>
              </h:form>

          .......

          <rich:modalPanel id="reload" height="130" top="200" left="300"
                               width="500" zindex="2000" resizeable="false" autosized="true">
                    <f:facet name="header">
                         <h:outputText value="${messages.confirmReload}" />
                    </f:facet>
                    <f:facet name="controls">
                         <h:graphicImage value="/img/close.png" style="cursor:pointer"
                              onclick="Richfaces.hideModalPanel('reload')" />
                    </f:facet>
                    <s:div styleClass="sureDelete">
                         <p>${messages.questionReload}<br/>${messages.questionRestartReloadInfo}</p>
                    </s:div>          
                    <h:form>
                         <h:panelGrid columns="2" styleClass="panelModalPanel" columnClasses="columnLeftModalPanel,columnRightModalPanel">
                              
                              <h:commandButton styleClass="boton" id="accept" value="${messages.actionAccept}"
                             onmouseover="this.style.backgroundColor='green';this.style.color='white';this.style.cursor='pointer'"
                             onmouseout="this.style.backgroundColor='';this.style.color='';this.style.cursor=''"
                             action="#{deviceinformation.recargarEquipo()}"/>
                            
                              <a4j:commandButton styleClass="boton" id="cancel" value="${messages.actionCancel}"
                              onclick="javascript:Richfaces.hideModalPanel('reload')"
                              onmouseover="this.style.backgroundColor='green';this.style.color='white';this.style.cursor='pointer'"
                              onmouseout="this.style.backgroundColor='';this.style.color='';this.style.cursor=''">
                    
                              </a4j:commandButton>
                         </h:panelGrid>
                    </h:form>
               </rich:modalPanel>
               
               <rich:modalPanel id="restart" height="130" top="200" left="300"
                               width="500" zindex="2000" resizeable="false" autosized="true">
                    <f:facet name="header">
                         <h:outputText value="${messages.confirmRestart}" />
                    </f:facet>
                    <f:facet name="controls">
                         <h:graphicImage value="/img/close.png" style="cursor:pointer"
                              onclick="Richfaces.hideModalPanel('restart')" />
                    </f:facet>
                    <s:div styleClass="sureDelete">
                         <p>${messages.questionRestart}<br/>${messages.questionRestartReloadInfo}</p>
                    </s:div>          
                    <h:form>
                         <h:panelGrid columns="2" styleClass="panelModalPanel" columnClasses="columnLeftModalPanel,columnRightModalPanel">
                              <h:commandButton styleClass="boton" id="accept" value="${messages.actionAccept}"
                             onmouseover="this.style.backgroundColor='green';this.style.color='white';this.style.cursor='pointer'"
                             onmouseout="this.style.backgroundColor='';this.style.color='';this.style.cursor=''"
                             action="#{deviceinformation.reinicioEquipo()}"/>
                          
                              <a4j:commandButton styleClass="boton" id="cancel" value="${messages.actionCancel}"
                              onclick="javascript:Richfaces.hideModalPanel('restart')"
                              onmouseover="this.style.backgroundColor='green';this.style.color='white';this.style.cursor='pointer'"
                              onmouseout="this.style.backgroundColor='';this.style.color='';this.style.cursor=''">
                              
                              </a4j:commandButton>
                         </h:panelGrid>
                    </h:form>
               </rich:modalPanel>
               
               </ui:define>

          </ui:composition>
          • 2. Re: a4j commandButton in a modal Panel end conversation
            Guilherme Almeida Newbie

            Hello,


            I have this same exact problem. Any ideias on this one?
            Thank you.