You need to sign in to do that
Don't have an account?
Salesforce 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:form>
<apex:pageBlock>
<apex:pageBlockSection title="Business Type">
<apex:inputField value="{!NCQ__c.Business_Type__c}">
<apex:actionSupport event="onchange" rerender="McQuestions" immediate="true"/>
</apex:inputField>
</apex:pageBlockSection>
<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%"/>
<p/>
</apex:outputPanel>
<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%"/>
<p/>
</apex:outputPanel>
</apex:pageBlock>
</apex:form>
</apex:tab>
</apex:tabPanel>
</apex:page>
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!
-Chris
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:form>
<apex:pageBlock>
<apex:pageBlockSection title="Business Type">
<apex:inputField value="{!NCQ__c.Business_Type__c}">
<apex:actionSupport event="onchange" rerender="McQuestions" immediate="true"/>
</apex:inputField>
</apex:pageBlockSection>
<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%"/>
<p/>
</apex:outputPanel>
<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%"/>
<p/>
</apex:outputPanel>
</apex:pageBlock>
</apex:form>
</apex:tab>
</apex:tabPanel>
</apex:page>
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!
-Chris
When you say Immediate="true" the setters will not happen, that could be the reason.
Please remove immediate="true", that should resolve this.
Regards,
*************
J G
-Chris
This is how the component looks like when I load the component the first time.
Then I press the button "Add a card", which add two more inputfields.
Gone are:
Your ideas will be much appreciated!
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).
Solution:
Put the text in a <apex:outputText></apex:outputText>
Now this is even possible: