2 Replies Latest reply on May 27, 2008 10:45 AM by leandro godoy

    Problems with reRender

    leandro godoy Apprentice

      I can not be rendered that the panels below according to the selected option in follows the code if someone can ajuder I am grateful

      
       <a4j:outputPanel id="panel" ajaxRendered="true">
      
       <h:selectOneRadio value="#{cliente.cliente.tipopessoa}" immediate="true" >
       <a4j:support event="onclick" action="#{cliente.mudaPessoa}" reRender="pf,pj,r" immediate="true" ajaxSingle="true" status="status"></a4j:support>
       <f:selectItem itemLabel="#{msg.pessoafisica}"id="chpf" itemValue="true"/>
      
       <f:selectItem itemLabel="#{msg.pessoajuridica}"id="chpj" itemValue="false"/>
       </h:selectOneRadio>
      
       </a4j:outputPanel>
      
      
      
      
      <a4j:region id="pf" rendered="#{cliente.cliente.tipopessoa}" immediate="true">
       <h:panelGrid columns="2" width="730">
       <h:panelGroup>
       <h:outputText value="#{msg.nome}"></h:outputText>        
       <rich:spacer width="13"></rich:spacer>
      
       <h:inputText value="#{cliente.pessoafisica.nome}" id="nome" required="true"
       style=" width : 507px;" styleClass="select" maxlength="40">
       </h:inputText>
       </h:panelGroup><br>
       <h:panelGroup>
       <h:outputText value="#{msg.cpf}"></h:outputText>            
       <rich:spacer width="13"></rich:spacer>
       <h:panelGroup>
       <h:inputText value="#{cliente.pessoafisica.cpf}"onkeypress="mascara(this,soNumeros)"
       maxlength="11" style=" width : 123px;" id="icpf" onblur=" VerificaCPF ();"
       required="#{cliente.cliente.tipopessoa}" >
      
       </h:inputText>
       <h:inputHidden value=""></h:inputHidden>
       </h:panelGroup>
        
      
       <h:outputText value="#{msg.rg}"></h:outputText><rich:spacer width="11"></rich:spacer>
       <h:panelGroup>
       <h:inputText value="#{cliente.pessoafisica.rg}"onkeypress="mascara(this,soNumeros)"
       styleClass="select" style=" width : 109px;" id="rg" required="#{cliente.cliente.tipopessoa}" >
       </h:inputText>
       <h:inputHidden value=""></h:inputHidden>
       </h:panelGroup>
      
      
       </h:panelGroup>
       </h:panelGrid>
       </a4j:region>
      
       <a4j:region id="pj" rendered="#{not cliente.cliente.tipopessoa}" immediate="true" >
       <h:panelGrid columns="3" width="712">
       <h:panelGroup>
       <h:outputText value="#{msg.nomefantasia}"></h:outputText>     
       <rich:spacer width="8"></rich:spacer>
       <h:inputText value="#{cliente.pessoajuridica.nomefantasia}"
       style=" width : 319px;" id="nf" maxlength="40" required="#{!cliente.cliente.tipopessoa}"
       styleClass="select"
       label="#{msg.nomefantasia}">
       </h:inputText>
       </h:panelGroup>
       <h:panelGroup>
       <h:outputText value="#{msg.cnpj}"></h:outputText><rich:spacer width="20"></rich:spacer>
       <h:inputText value="#{cliente.pessoajuridica.cnpj}" id="icnpj" onkeypress="mascara(this,soNumeros)"
       maxlength="18" required="#{!cliente.cliente.tipopessoa}" style=" width : 190px;" label="#{msg.cnpj}" onblur="return validaCNPJ()">
       </h:inputText>
      
       </h:panelGroup>
       </h:panelGrid>
      
       </a4j:region>
      
      
       <a4j:region id="r" rendered="#{not cliente.cliente.tipopessoa}" immediate="true">
       <h:panelGrid columns="4" width="737">
       <h:outputText value="#{msg.ramo}"></h:outputText>
       <rich:spacer width="0"></rich:spacer>
       <h:inputText value="#{cliente.ramoatividade.descricao}" id="ramo"
       maxlength="40" styleClass="select" required="#{not cliente.cliente.tipopessoa}"
       style=" width : 318px;"></h:inputText>
       <h:inputHidden value=""></h:inputHidden>
       </h:panelGrid>
       </a4j:region>
      





        • 1. Re: Problems with reRender
          Ilya Shaikovsky Master

          1) why you using immeduate on your support? You really not need the select values to be applied?
          2) you should not reRender conditionally rendered element. You should wrap them to some parent which will be always present (a4j:outputPanel) and reRender the wrapper instead.

          • 2. Re: Problems with reRender
            leandro godoy Apprentice

            Ilya_shaikovsky OK, I put in the separate fields (a4j: outputPanel), but how can I deviate when one of validations (selectOneRadio) is selected?
            Because I am using submit () in the onchange it, is there a way to circumvent this?
            I need that when you select the selectOneradio be modified in the value bean, and that according to this figure is rendered either panel.
            thanks,hugs.