+ Start a Discussion
Salesforce Admin09823787045252064Salesforce Admin09823787045252064 

Rerendering outputPanel causes outputFields to disappear

Hi all,

I have the following visualforce code (simplified a little for clarity):

<apex:page standardController="NCQ__c">
  <apex:tabPanel id="tabPanel" switchType="client" selectedTab="BusinessAssessmentTab">
    <apex:tab id="BusinessAssessmentTab" label="Business Assessment" name="BusinessAssessmentTab">
          <apex:pageBlockSection title="Business Type">
            <apex:inputField value="{!NCQ__c.Business_Type__c}">
              <apex:actionSupport event="onchange" rerender="McQuestions" immediate="true"/>
          <apex:pageBlockSection id="BusinessAssessmentBlock" title="Business Assessment">
            <apex:outputPanel id="GeneralQuestions">
              <apex:outputField value="{!NCQ__c.BA_1_Question__c}" rendered="true"/>
              <apex:inputField value="{!NCQ__c.BA_1_Answer__c}" style="width: 100%"/>
            <apex:outputPanel id="McQuestions">
              <apex:outputField value="{!NCQ__c.BA_MC_1_Question__c}" rendered="true"/>
              <apex:inputField value="{!NCQ__c.BA_MC_1_Answer__c}" style="width: 100%"/>

I'd like to eventually hide or show the McQuestions panel based on the value of NCQ__c.Business_Type__c. Has a first step, I just had the McQuestions panel rerender on any change to Business_Type__c. For some reason, rerendering the panel causes the outputFields values to disappear from McQuestions. I have no clue what is going on! I'm hoping someone has some ideas? I've attached two images (before and after) to illustrate what is going on.

Please let me know if you need any further details!


User-added image
User-added image
Offshore Freelance ConsultantOffshore Freelance Consultant

When you say Immediate="true" the setters will not happen, that could be the reason. 

Please remove immediate="true", that should resolve this.


Salesforce Admin09823787045252064Salesforce Admin09823787045252064
I removed the immediate="true", but that didn't resolve the problem. Very strange. I'm at a loss for what the problem might be!

Jaap ScheperJaap Scheper
Same problem over here!
<apex:pageBlock id="listOfCards">
            <apex:pageBlockSection title="{!$Label.Cards}" >
                <apex:repeat value="{!cards}" var="card">

                    <apex:commandButton value="Delete card" action="{!Del}" rerender="listOfCards" immediate="true">
                        <apex:param name="rowToBeDeleted" value="{!card.listIndex}" assignTo="{!selectedRowIndex}"></apex:param>
                    </apex:commandButton>Enter a Name

                    <apex:pageBlockSectionItem >
                        <apex:outputLabel value="{!$Label.Card_Number}" />
                        <apex:inputText value="{!card.Number}" />
                    <c:Tooltip helpText="{!$Label.CardNumberFormatMessage}"/>
                    <apex:pageBlockSectionItem >
                        <apex:outputLabel value="{!$Label.Card_Name}" />
                        <apex:inputText value="{!card.Label}" />


                <apex:commandbutton value="Add a card" action="{!Add}" rerender="listOfCards"/>
This is how the component looks like when I load the component the first time.
Component after first time loading

Then I press the button "Add a card", which add two more inputfields.
Gone are:
  1. The text "Enter a Name"
  2. The component that displays the [i] with a text in a mousover box
Component after adding a card

Your ideas will be much appreciated!
Jaap ScheperJaap Scheper
Solved it!

Static texts are not rerendered when the parent block is being rerendered.
My Custom component used static text, so that's why my component seemed not to rerender (it did, only the text inside didnt).

Put the text in a <apex:outputText></apex:outputText>

Now this is even possible:
<apex:outputText escape="false" >
<div class="mouseOverInfoOuter" onfocus="addMouseOver(this)" onmouseover="addMouseOver(this)" tabindex="0"><img src="/s.gif" alt="" class="infoIcon" title="" />
<div class="mouseOverInfo" style="display: none; left: 16px;">{!mouseOverText}</div>