1 Reply Latest reply on Jan 10, 2013 10:48 PM by Erick Barreto

    Seam 2.3.0 + RichFaces 4.2.3 - <a:ajax> not being triggered

    Erick Barreto Newbie

      Hi

       

      I'm creating this discussion because i havent found any problems similar to the one i'm facing. I've searched a lot and could not find a solution. So, my problem is: i have a form with many fields(most of them inputTexts + <s:decorate>), so i'm using <a:ajax event="blur" bypassUpdates="true"> to validate these fields when they lose focus. The problem is that i think the ajax is not being triggered or at least not completing the request. I've put the onbegin and oncomplete attributes in the tag, the first one is called but the second isn't along with the listener. I think i might be doing something wrong.  

       

      I'm using JSF 2.1.14 + RichFaces 4.2.3 + Seam 2.3.0

       

      I am putting here only a small part of 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.org/schema/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:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich" 
                template="layout/template.xhtml">
                <ui:define name="header">
                          <meta lang="pt" http-equiv="Content-Type"
                                    content="text/html; charset=UTF-8" />
                </ui:define>
                <ui:define name="body">
                          <a4j:status>
                  <f:facet name="start">
                      <h:graphicImage value="/img/ai.gif" alt="ai" />
                  </f:facet>
              </a4j:status>
                          <h:form id="usuario" styleClass="edit">
                                    <rich:panel>
                                              <rich:collapsiblePanel header="Info"
                                                        switchType="client">
                                                        <s:decorate id="nomeField" template="layout/edit.xhtml">
                                                                  <ui:define name="label">Nome</ui:define>
                                                                  <h:outputLabel value="#{usuarioHome.instance.pessoa.nome}" />
                                                                  <h:inputText id="nome" size="10" maxlength="10"
                                                                            value="#{usuarioHome.instance.pessoa.nome}" required="true">
                                                                            <a4j:ajax event="blur" onbegin="alert('teste');" oncomplete="alert('test');" render="nomeField" bypassUpdates="true" listener="#{usuarioHome.test()}" />
                                                                  </h:inputText>
                                                        </s:decorate>
                                                        .
                                                        .
                                                        .
                                                        .
                                    </rich:panel>
                          </h:form>
                </ui:define>
      </ui:composition>
      

       

      "UsuarioHome" is my EntityHome Class with Conversation scope. The "test" method has only a System.out. I also debugged the code and i see the method is not called.


       

      Thanks for your time,

      Erick

        • 1. Re: Seam 2.3.0 + RichFaces 4.2.3 - <a:ajax> not being triggered
          Erick Barreto Newbie

          I was able to get it working, however i don't know the cause of the problem. In my message i didn't put the entire code, so there were some important things missing. There are 3 h:commandButtons and 2 s:buttons. When removing the 2 s:buttons from the <h:form>, the ajax request was completed. I have no idea why.

           

          Here's part of the code missing:

           

          <div class="actionButtons">

          <h:commandButton id="save" value="Save"

          action="#{usuarioHome.persist}" disabled="#{!usuarioHome.wired}"

          rendered="#{!usuarioHome.managed}">

          <s:conversationId />

          </h:commandButton>

          <h:commandButton id="update" value="Save"

          action="#{usuarioHome.update}" rendered="#{usuarioHome.managed}">

          <s:conversationId />

          </h:commandButton>

          <h:commandButton id="delete" value="Delete"

          action="#{usuarioHome.remove}" immediate="true"

          rendered="#{usuarioHome.managed}" />

          <s:button id="cancelEdit" value="Cancel" propagation="end"

          view="/Usuario.xhtml" rendered="#{usuarioHome.managed}" />

          <s:button id="cancelAdd" value="Cancel" propagation="end"

          view="/#{empty usuarioFrom ? 'UsuarioList' : usuarioFrom}.xhtml"

          rendered="#{!usuarioHome.managed}" />

          </div>

           

          this was inside of the <h:form>. After removing both <s:buttons> from the form, it worked. Does anyone know why? Has anyone had any issues similar to mine? This is really weird.

           

          Thanks,

          Erick