0 Replies Latest reply on Feb 23, 2011 4:26 PM by Edilmar Alves

    Problems with suggestionBox x a4j:support

    Edilmar Alves Expert

      Hi,

       

      My webapp is JSF2/RichFaces3.3.3/GlassFish3.0.1/CDI/JPA/Hibernate3.

       

      I have 3 suggestionBoxes, "Customer", "Source City" and "Destination City".

      When the user selects a "Customer", I implemented an a4j:support onblur event into "Customer" inputText/suggestionBox to process the "Customer" (calling setCustomer(...) entity method, and reRender "Source" and "Destination", setting the city of the customer in both fields).

      All works fine, process and reRender. However, after setup a city suggestionBox from entity method, if I try to change the city to other, processing a new search into database, this doesn't work, the suggestionBox "transforms" in a simple inputText, none JS/AJAX events work more. I think when I setup the object into entity and reRender the inputText/suggestionBox, this component becomes "without JS power".

       

      The code for the "Customer" inputText/suggestionBox is below:

       

       

      <h:outputText value="Cliente:" />

      <a4j:region id="a4j_Pedido_cliente">

      <h:inputText id="Pedido_cliente" value="#{pedido.entity.cliente}" size="40" required="true">

        <f:converter converterId="clienteConverter"/>

        <a4j:support ajaxSingle="true"

          process="Pedido_cidOrig,Pedido_cidDest,Pedido_cliente"

          reRender="Pedido_cidOrig,Pedido_cidDest" event="onblur"/>

      </h:inputText>

      <rich:suggestionbox id="lookupPedido_cliente" width="350" for="Pedido_cliente" tokens="-"

                          suggestionAction="#{pedido.clienteLookup}" var="clienteItem"

                          rules="none" minChars="1" rows="#{login.maxResultConsultas}"

                          columnClasses="center">

        <h:column>

          <h:outputText value="#{clienteItem}" />

        </h:column>

      </rich:suggestionbox>

      <a4j:status>

          <f:facet name="start">

              <h:graphicImage  value="/imagens/processar.gif"/>

          </f:facet>

      </a4j:status>

      </a4j:region>

       

      The code for "Source City" is here:

       

      <h:outputText value="Remetente:" />

      <a4j:region id="a4j_Pedido_clRemet">

      <h:inputText id="Pedido_clRemet" value="#{pedido.entity.clRemet}" size="40" required="true">

        <f:converter converterId="cidConverter"/>

      </h:inputText>

      <rich:suggestionbox id="lookupPedido_clRemet" width="350" for="Pedido_clRemet" tokens="-"

                          suggestionAction="#{pedido.clRemetLookup}" var="clRemetItem"

                          rules="none" minChars="1" rows="#{login.maxResultConsultas}"

                          columnClasses="center">

        <h:column>

          <h:outputText value="#{clRemetItem}" />

        </h:column>

      </rich:suggestionbox>

      <a4j:status>

          <f:facet name="start">

              <h:graphicImage  value="/imagens/processar.gif"/>

          </f:facet>

      </a4j:status>

      </a4j:region>

       

      I have a4j:status to show processar.gif image when user types some string and the server is looking for the results...