function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SeanCenoSeanCeno 

Visualforce Rerendering Issue

All,
I'm trying to display a pageBlockSection based on the value of a picklist. But when I make the selection in the picklist, the pageBlockSection is not displayed. I have also tried wrapping it in an outputPanel container as well. Is my syntax incorrect in the rendered attribute? Here is a snippet of my code:
<apex:pageBlockSection title="Pre-Approval Form Required?" columns="2" rendered="{!NOT(ISBLANK(marketingReimbursementForm))}" collapsible="True">
        		<apex:pageBlockSectionItem >
        			<apex:outputLabel value="{!$ObjectType.Marketing_Reimbursement__c.Fields.Pre_Approval_Required__c.Label}" />
        			<apex:outputPanel layout="block" styleClass="requiredBlock">
        				<apex:actionRegion>
        					<apex:inputField value="{!MarketingReimbursement.Pre_Approval_Required__c}" required="true">
        						<apex:actionSupport event="onchange" rerender="preApprovalFormContainer" />
        					</apex:inputField>
        				</apex:actionRegion>
        			</apex:outputPanel>
        		</apex:pageBlockSectionItem>
        	</apex:pageBlockSection>
        	
        	<apex:outputPanel id="preApprovalFormContainer">
        	<apex:pageBlockSection id="preApprovalForm" title="Pre-Approval Form" columns="2" rendered="{!(marketingReimbursement.Pre_Approval_Required__c =='Yes')}" collapsible="False">
        		<apex:pageBlockSectionItem   >
        			<apex:outputLabel value="{!$ObjectType.Marketing_Reimbursement_Forms__c.Fields.Northstar_Registered_Representative__c.Label}" />
        			<apex:outputPanel layout="block" styleClass="requiredInput">
        				<apex:inputField value="{!marketingReimbursementForm.Northstar_Registered_Representative__c}" required="true"/>
        			</apex:outputPanel>
        		</apex:pageBlockSectionItem>

 
SandhyaSandhya (Salesforce Developers) 
Hi,

Try to re-render the entire pageBlock  instead of trying to re-render just the one inputField.

Please refer below links for similar discussion that may help you.

http://salesforce.stackexchange.com/questions/42745/action-support-rerender-not-working
 
https://developer.salesforce.com/forums/?id=906F000000095w2IAA
 
http://salesforce.stackexchange.com/questions/69948/visualforce-action-support-rerender-not-working

 Hope this helps you!

If this helps you please mark it as solved.

Thanks and Regards
Sandhya
SeanCenoSeanCeno
Hey Sandhya,
Thanks for the reply. I tried rerendering the pageBlock and that just ends up rerendering the page and changing the picklist value back to default of null. I also looked at your links which all recommend wrapping the pageBlockSection in an outputPanel, which I've done. I've also tried removing the actionRegion, which the 3rd link suggested. Is it not possible to render a pageBlockSection based on the selection of an input field of another pageBlockSection? Meaning, does it need to be a pageBlockSectionItem like a Parent-Child relationship? Here is the full VF Page thus far if that helps:
 
<apex:page standardController="Marketing_Reimbursement__c" extensions="MarketingReimbursement" action="{!redirect}">
    <apex:sectionHeader title="{!$ObjectType.Marketing_Reimbursement__c.Label}" subtitle="{!marketingReimbursement.Name}" />
    
    <apex:form id="page">
    	<apex:pageBlock id="test" title="{!$ObjectType.Marketing_Reimbursement__c.Label} Edit" mode="edit" rendered="{!currentMode == 'edit'}">
            <apex:pageBlockButtons location="top">
                <apex:commandButton value="Create New" action="{!saveAndView}" rendered="{!AND(ISBLANK(MarketingReimbursement.Id))}" />
                <apex:commandButton value="Save" action="{!saveAndView}" rendered="{!NOT(ISBLANK(MarketingReimbursement.Id))}" />
                <apex:commandButton value="Cancel" action="{!cancel}" immediate="true" />
            </apex:pageBlockButtons>

            <apex:outputPanel layout="block" style="padding: 0.5em 1.0em;">
                <apex:pageMessage severity="Confirm" strength="1" summary="{!confirmationMessage}" rendered="{!NOT(ISBLANK(confirmationMessage))}" />
                <apex:pageMessages />
            </apex:outputPanel>

            <apex:pageBlockSection title="Information" />

            <apex:panelGrid styleClass="gridEdit" columns="2">
                <apex:outputLabel value="{!$ObjectType.Marketing_Reimbursement__c.Fields.OwnerId.Label}" />
                <apex:outputLabel value="{!$ObjectType.Marketing_Reimbursement__c.Fields.Event_Date__c.Label}" />

                <apex:inputField value="{!MarketingReimbursement.OwnerId}" />
                <apex:inputField value="{!MarketingReimbursement.Event_Date__c}" />
            </apex:panelGrid>
        </apex:pageBlock>

        <apex:detail relatedList="false" title="false" rendered="{!currentMode == 'view'}" />

        <apex:pageBlock id="marketingReimbursementForms" title="{!$ObjectType.Marketing_Reimbursement_Forms__c.LabelPlural}" rendered="{!currentMode == 'view'}" mode="edit" >
        	<apex:pageBlockButtons location="top">
                <apex:commandButton value="New" rendered="{!AND(NOT(isRecordLocked), ISBLANK(marketingReimbursementForm))}" action="{!createForm}" rerender="marketingReimbursementForms"  />
                <apex:outputPanel layout="block" style="float: right; vertical-align: middle; margin-right: 1em;" rendered="{!AND(ISBLANK(marketingReimbursementForm))}"/>
                <apex:commandButton value="Save" rendered="{!NOT(ISBLANK(marketingReimbursementForm))}" action="{!upsertForm}" rerender="marketingReimbursementForms"/>
                <apex:commandButton value="Cancel" rendered="{!NOT(ISBLANK(marketingReimbursementForm))}" action="{!cancelForm}" immediate="true" rerender="marketingReimbursementForms" />
            </apex:pageBlockButtons>

        	<apex:pageBlockSection title="Pre-Approval Form Required?" columns="2" rendered="{!NOT(ISBLANK(marketingReimbursementForm))}" collapsible="True">
        		<apex:pageBlockSectionItem>
        			<apex:outputLabel value="{!$ObjectType.Marketing_Reimbursement__c.Fields.Pre_Approval_Required__c.Label}" />
        			<apex:outputPanel layout="block" styleClass="requiredBlock">
        				<apex:actionRegion>
        					<apex:inputField value="{!MarketingReimbursement.Pre_Approval_Required__c}" required="true">
        						<apex:actionSupport event="onchange" rerender="preApprovalFormContainer"/>
        					</apex:inputField>
        				</apex:actionRegion>
        			</apex:outputPanel>
        		</apex:pageBlockSectionItem>
        	</apex:pageBlockSection>
        	
        	<apex:outputPanel id="preApprovalFormContainer">
        	<apex:pageBlockSection id="preApprovalForm" title="Pre-Approval Form" columns="2" rendered="{!marketingReimbursement.Pre_Approval_Required__c == 'Yes'}">
        		<apex:pageBlockSectionItem>
        			<apex:outputLabel value="{!$ObjectType.Marketing_Reimbursement_Forms__c.Fields.Northstar_Registered_Representative__c.Label}" />
        			<apex:outputPanel layout="block" styleClass="requiredInput">
        				<apex:inputField value="{!marketingReimbursementForm.Northstar_Registered_Representative__c}" required="true"/>
        			</apex:outputPanel>
        		</apex:pageBlockSectionItem>

        		<apex:pageBlockSectionItem>
        			<apex:outputLabel value="{!$ObjectType.Marketing_Reimbursement_Forms__c.Fields.Date_of_Event__c.Label}" />
        			<apex:outputPanel layout="block" styleClass="requiredInput">
        				<apex:inputField value="{!marketingReimbursementForm.Date_of_Event__c}" required="true"/>
        			</apex:outputPanel>
        		</apex:pageBlockSectionItem>

        		<apex:pageBlockSectionItem>
        			<apex:outputLabel value="{!$ObjectType.Marketing_Reimbursement_Forms__c.Fields.Reimbursement_Amount__c.Label}" />
        			<apex:outputPanel layout="block" styleClass="requiredInput">
        				<apex:inputField value="{!marketingReimbursementForm.Reimbursement_Amount__c}" required="true"/>
        			</apex:outputPanel>
        		</apex:pageBlockSectionItem>

        		<apex:pageBlockSectionItem>
        			<apex:outputLabel value="{!$ObjectType.Marketing_Reimbursement_Forms__c.Fields.Attending_The_Event__c.Label}" />
        			<apex:outputPanel layout="block" styleClass="requiredInput">
        				<apex:inputField value="{!marketingReimbursementForm.Attending_The_Event__c}" required="true"/>
        			</apex:outputPanel>
        		</apex:pageBlockSectionItem>

        		<apex:pageBlockSectionItem>
        			<apex:outputLabel value="{!$ObjectType.Marketing_Reimbursement_Forms__c.Fields.Description__c.Label}" />
        			<apex:outputPanel layout="block" styleClass="requiredInput">
        				<apex:inputField value="{!marketingReimbursementForm.Description__c}" required="true"/>
        			</apex:outputPanel>
        		</apex:pageBlockSectionItem>

        	</apex:pageBlockSection>

        	<apex:pageBlockSection id="selectForm" title="Select Form" columns="2" rendered="{!marketingReimbursement.Pre_Approval_Required__c == 'No'}">
				<apex:pageBlockSectionItem>
					<apex:outputLabel value="{!$ObjectType.Marketing_Reimbursement__c.Fields.Reimbursement_Type__c.Label}"/>
        			<apex:outputPanel layout="block" styleClass="requiredInput">
        				<apex:actionRegion>
        					<apex:inputField value="{!MarketingReimbursement.Reimbursement_Type__c}" required="true">
        						<apex:actionSupport event="onchange" rerender="inputForms" action="{!rerender}"/>
        					</apex:inputField>
        				</apex:actionRegion>
        			</apex:outputPanel>
        		</apex:pageBlockSectionItem>
        	</apex:pageBlockSection>
        	</apex:outputPanel>

        	<apex:outputPanel id="inputForms">
        	<apex:pageBlockSection id="Reimbursement_Form" title="Reimbursement Form" rendered="{!MarketingReimbursement.Reimbursement_Type__c == 'Reimbursement Form'}">
        		<apex:pageBlockSectionItem>
					<apex:outputLabel value="{!$ObjectType.Marketing_Reimbursement__c.Fields.Reimbursement_Type__c.Label}"/>
        			<apex:outputPanel layout="block" styleClass="requiredInput">
        				<apex:inputField value="{!MarketingReimbursement.Reimbursement_Type__c}" required="true">
        				</apex:inputField>
        			</apex:outputPanel>
        		</apex:pageBlockSectionItem>
        	</apex:pageBlockSection>

        	<apex:pageBlockSection id="Reimbursement_Form_Ameriprise" title="Reimbursement Form - Ameriprise" rendered="{!MarketingReimbursement.Reimbursement_Type__c == 'Reimbursement Form - Ameriprise'}">
        		<apex:pageBlockSectionItem>
					<apex:outputLabel value="{!$ObjectType.Marketing_Reimbursement__c.Fields.Reimbursement_Type__c.Label}"/>
        			<apex:outputPanel layout="block" styleClass="requiredInput">
        				<apex:inputField value="{!MarketingReimbursement.Reimbursement_Type__c}" required="true">
        				</apex:inputField>
        			</apex:outputPanel>
        		</apex:pageBlockSectionItem>
        	</apex:pageBlockSection>

        	<apex:pageBlockSection id="OSE_Form" title="Outside Speaking Engagement Approval Form" rendered="{!MarketingReimbursement.Reimbursement_Type__c == 'Outside Speaking Engagement Approval Form'}">
        		<apex:pageBlockSectionItem>
					<apex:outputLabel value="{!$ObjectType.Marketing_Reimbursement__c.Fields.Reimbursement_Type__c.Label}"/>
        			<apex:outputPanel layout="block" styleClass="requiredInput">
        				<apex:inputField value="{!MarketingReimbursement.Reimbursement_Type__c}" required="true">
        				</apex:inputField>
        			</apex:outputPanel>
        		</apex:pageBlockSectionItem>
        	</apex:pageBlockSection>
        	</apex:outputPanel>

            <apex:outputLabel style="padding: 0.5em 1em; padding-top: 0; display: block;" value="No records to display." rendered="{!AND(MarketingReimbursementFormsListSize == 0, ISBLANK(marketingReimbursementForm))}" />
        </apex:pageBlock>
    </apex:form> 

    <apex:relatedList subject="{!MarketingReimbursement}" list="CombinedAttachments" rendered="{!currentMode == 'view'}" />
    <apex:relatedList list="ProcessSteps" rendered="{!AND(currentMode == 'view', NOT(ISBLANK(marketingReimbursement.Approval_Status__c)), marketingReimbursement.Approval_Status__c != 'Draft')}" />

</apex:page>