6 Replies Latest reply on May 9, 2011 9:12 AM by danilocmiranda

    Cant re-render a componente in other form

    danilocmiranda

      Hello guys,

       

      I have a InputNumberSlider and want to re-render a component (outputPanel) in another form

      Look the code

      <h:form id="form_slide_number">
      
      <rich:inputNumberSlider value="#{produtoViewPB.filtoPreco}" width="40"  
      maxValue="#{produtoViewPB.showTooltip="false" id="inputNumber" >
      
      <f:ajax event="change" render=":form_slide_number:inputNumber:busca_produto" 
      listener="#{produtoViewPB.</rich:inputNumberSlider>
      
      
      </h:form>
      
      

       

       

       

      <h:form>
      <a4j:outputPanel id="busca_produtos" ajaxRendered="true" >
                                    <h:form id="form_resultado_busca">
      
      <ui:repeat value="#{produtoViewPB.listProdutos}" var="<div class="box_produtos_selecionados" id="01">
                        <div class="img_produtos_selecionados">
                        <h:commandLink action="#{produtoViewPB.detalhesProduto}">
                        <h:graphicImage value="#{produtoTabela.foto}" alt="produto"
                        width="114" height="114" id="id1" />
                        <f:setPropertyActionListener target="#{produtoViewPB.id}"
                        value="#{produtoTabela.codigo}" />
                        <f:setPropertyActionListener target="#{produtoViewPB.ref}"
                        value="#{produtoTabela.refModelo}" />
                        </h:commandLink>
      </a4j:outputPanel
      </form>
      

       

      Look the message:

       

      javax.servlet.ServletException: inputNumber

      javax.faces.webapp.FacesServlet.service(FacesServlet.java:321)

        • 1. Cant re-render a componente in other form
          nbelaevski

          Hi Danilo,

           

          What component has 'busca_produto' id? Do you have nested forms?

          • 2. Cant re-render a componente in other form
            danilocmiranda

            Nick,

             

            This 'busca_produto' id is the id of a4j:outputPanel. My bad, typing wrong...

             

             

            I already correct this mistake and the error message doesn't has changed: javax.servlet.ServletException: inputNumber

             

            In answer for your question, I just have the inputNumberSlider inside the form by id = form_slide_number and the outputPanel id="busca_produtos" inside the form by id="form_resultado_busca"

             

            When the value of inputNumberSlider id changed, a method of my bean clean the List (listProdutos) of the ui:repeat but this is not refreshed

            • 3. Cant re-render a componente in other form
              nbelaevski

              I see, so you are using incorrect client id, it should be :formId:componentId, not what you set. BTW, if you use a4j:ajax you won't need to use client id, render="busca_produto" will work as well.

              • 4. Re: Cant re-render a componente in other form
                danilocmiranda

                Nick,

                 

                 

                I did this way and it worked.

                 

                My form whit the InputNumberSlider:

                
                <h:form id="form_slide_number">
                      <rich:inputNumberSlider value="#{produtoViewPB.filtoPreco}" width="90px"  maxValue="#{produtoViewPB.maiorPreco}"
                      showTooltip="false" id="inputNumber" >
                          <f:ajax event="change"  listener="#{produtoViewPB.filtrarBuscaPorPreco}" render=":form_resultado_busca:busca_produtos" /> 
                         </rich:inputNumberSlider>
                </h:form>
                
                

                 

                My form whit outputPanel inside:

                 

                <h:form id="form_resultado_busca">
                
                     <a4j:outputPanel id="busca_produtos" ajaxRendered="true" >
                          <ui:repeat value="#{produtoViewPB.listProdutos}" var="produtoTabela" >
                                <div class="box_produtos_selecionados" id="01">
                //THE REST OF CODE......
                </h:form>
                
                

                 

                So, you sad....

                Nick Belaevski wrote:

                 

                .... if you use a4j:ajax you won't need to use client id, render="busca_produto" will work as well.

                If I change

                 

                <f:ajax event="change"  listener="#{produtoViewPB.filtrarBuscaPorPreco}" render=":form_resultado_busca:busca_produtos" />

                 

                By

                 

                <a4j:ajax event="change"  listener="#{produtoViewPB.filtrarBuscaPorPreco}" render="busca_produtos" />

                 

                Will work too?

                • 5. Re: Cant re-render a componente in other form
                  ilya_shaikovsky
                  <a4j:ajax event="change"  listener="#{produtoViewPB.filtrarBuscaPorPreco}" render="busca_produtos" />

                  yes it should works too actually.

                   

                  Minor hint:

                       <a4j:outputPanel id="busca_produtos" ajaxRendered="true" >
                            <ui:repeat value="#{produtoViewPB.listProdutos}" var="produtoTabela" >
                                  <div class="box_produtos_selecionados" id="01">
                  add layout="block" to outputPanel. in other case it rendered as span and you have div inside which causes invalid html.

                  • 6. Re: Cant re-render a componente in other form
                    danilocmiranda

                    Ilya,

                     

                    Good to know, soon as possible I will try that option!

                     

                    Thanks for help guys!