You need to sign in to do that
Don't have an account?
Andrew Hoban 6
Can you Rerender multiple Page Block Sections?
Hi,
I was wondering if its possible if its possible to rerender multiple page block sections? I would like a new page block section titled "Agent Information" to be displayed when Agency is selected from Lead Source.
Thanks
VF Page:
I was wondering if its possible if its possible to rerender multiple page block sections? I would like a new page block section titled "Agent Information" to be displayed when Agency is selected from Lead Source.
Thanks
VF Page:
<apex:page standardController="lead"> <apex:sectionHeader title="Lead Edit" subtitle="{!lead.Name}"/> <apex:form > <apex:pageBlock title="Lead Edit" mode="edit"> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}"/> <apex:commandButton value="Save & New" action="{!save}" /> <apex:commandButton value="Cancel" action="{!cancel}"/> </apex:pageBlockButtons> <apex:actionRegion > <apex:pageBlockSection title="Lead Information" columns="2"> <apex:inputField value="{!lead.Sponsorship_Sectors__c}" required="true"/> <apex:inputField value="{!lead.Status}" required="true"/> <apex:inputField value="{!lead.Rating}" required="false"/> <apex:inputField value="{!lead.leadsource}"> <apex:actionSupport event="onchange" rerender="AgentInfo"/> </apex:inputField> <apex:inputField value="{!lead.Sponsorship_Catergory__c}" required="false"/> </apex:pageBlockSection> </apex:actionRegion> <apex:outputPanel id="AgentInfo"> <apex:pageBlockSection id="theSection" columns="1" rendered="{!lead.leadsource != 'Agency'}"> <apex:pageBlockSection title="Lead Contact Information" columns="2"> <apex:inputField value="{!lead.FirstName}" required="false"/> <apex:inputField value="{!lead.Email}" required="true"/> <apex:inputField value="{!lead.LastName}" required="true"/> <apex:inputField value="{!lead.Phone}" required="true"/> <apex:inputField value="{!lead.Company}" required="true"/> <apex:inputField value="{!lead.MobilePhone}" required="false"/> <apex:inputField value="{!lead.Job_Title__c}" required="false"/> <apex:inputField value="{!lead.Direct_Line__c}" required="false"/> <apex:inputField value="{!lead.Website}" required="false"/> <apex:inputField value="{!lead.LinkedIn_URL__c}" required="false"/> </apex:pageBlockSection> <apex:pageBlockSection title="Address Information" columns="1"> <apex:inputField value="{!lead.Street}" required="false"/> <apex:inputField value="{!lead.City}" required="false"/> <apex:inputField value="{!lead.State}" required="false"/> <apex:inputField value="{!lead.PostalCode}" required="false"/> <apex:inputField value="{!lead.Country}" required="false"/> </apex:pageBlockSection> </apex:pageBlockSection> <apex:pageBlockSection id="theSection1" columns="1" rendered="{!lead.leadsource == 'Agency'}"> <apex:pageBlockSection title="Lead Contact Information" columns="2"> <apex:inputField value="{!lead.FirstName}" required="false"/> <apex:inputField value="{!lead.Email}" required="true"/> <apex:inputField value="{!lead.LastName}" required="true"/> <apex:inputField value="{!lead.Phone}" required="true"/> <apex:inputField value="{!lead.Company}" required="true"/> <apex:inputField value="{!lead.MobilePhone}" required="false"/> <apex:inputField value="{!lead.Job_Title__c}" required="false"/> <apex:inputField value="{!lead.Direct_Line__c}" required="false"/> <apex:inputField value="{!lead.Website}" required="false"/> <apex:inputField value="{!lead.LinkedIn_URL__c}" required="false"/> </apex:pageBlockSection> <apex:pageBlockSection title="Address Information" columns="1"> <apex:inputField value="{!lead.Street}" required="false"/> <apex:inputField value="{!lead.City}" required="false"/> <apex:inputField value="{!lead.State}" required="false"/> <apex:inputField value="{!lead.PostalCode}" required="false"/> <apex:inputField value="{!lead.Country}" required="false"/> </apex:pageBlockSection> <apex:pageBlockSection title="Agent Information" columns="1"> <apex:inputField value="{!lead.Agency__c}" required="TRUE"/> <apex:inputField value="{!lead.First_Name_Agent__c}" required="TRUE"/> <apex:inputField value="{!lead.Last_Name_Agent__c}" required="TRUE"/> <apex:inputField value="{!lead.Phone_Agent__c}" required="TRUE"/> <apex:inputField value="{!lead.Email_Agent__c}" required="TRUE"/> </apex:pageBlockSection> <apex:pageBlockSection title="System Information" columns="2"> <apex:inputField value="{!lead.OwnerId}" required="false"/> </apex:pageBlockSection> </apex:pageBlockSection> </apex:outputPanel> </apex:pageBlock> </apex:form> </apex:page>
<apex:pageBlockSection title="Agent Information " columns="1" rendered="{!lead.leadsource == 'Other'}" >
<apex:inputField value="{!lead.Street}" required="false"/>
<apex:inputField value="{!lead.City}" required="false"/>
</apex:pageBlockSection>
2) If you want this section inside another page block section then,
<apex:pageBlockSection id="theSection1" columns="1" rendered="{!lead.leadsource == 'Other' || lead.leadsource == 'Something else' }">
<apex:pageBlockSection title="Agent Information Something else" columns="1" rendered="{!lead.leadsource == 'Something else'}" >
<apex:inputField value="{!lead.Street}" required="false"/>
<apex:inputField value="{!lead.City}" required="false"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Agent Information Other'" columns="1" rendered="{!lead.leadsource == 'Other'}" >
<apex:inputField value="{!lead.Street}" required="false"/>
<apex:inputField value="{!lead.City}" required="false"/>
</apex:pageBlockSection>
</apex:pageBlockSection>
3) or, if possible you can rerender all sections you want in rerender attribute
<apex:inputField value="{!lead.leadsource}">
<apex:actionSupport event="onchange" rerender="AgentInfo,anothersection,onemoresection"/>
</apex:inputField>
My issue is that I only want to add an extra page block section if Lead Source = 'Agency'. I have tried the numebrous ways you have highlighted but the page is still not rendering. Im not sure if its due to my action region being located for the first page blok section?
Thanks
<apex:page standardController="lead">
<apex:sectionHeader title="Lead Edit" subtitle="{!lead.Name}"/>
<apex:form >
<apex:pageBlock title="Lead Edit" mode="edit">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Save & New" action="{!save}" />
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:actionRegion >
<apex:pageBlockSection title="Lead Information" columns="2">
<!-- <apex:inputField value="{!lead.Sponsorship_Sectors__c}" required="true"/> -->
<apex:inputField value="{!lead.Status}" required="true"/>
<apex:inputField value="{!lead.Rating}" required="false"/>
<apex:inputField value="{!lead.leadsource}">
<apex:actionSupport event="onchange" rerender="AgentInfo"/>
</apex:inputField>
<!-- <apex:inputField value="{!lead.Sponsorship_Catergory__c}" required="false"/> -->
</apex:pageBlockSection>
</apex:actionRegion>
<apex:outputPanel id="AgentInfo">
<apex:pageBlockSection title="Agent Information Agency " columns="1" rendered="{!lead.leadsource == 'Agency'}" >
<apex:inputField value="{!lead.Street}" required="false"/>
<apex:inputField value="{!lead.City}" required="false"/>
</apex:pageBlockSection>
<apex:pageBlockSection id="theSection" columns="1" >
<apex:pageBlockSection title="Web" columns="2" >
<apex:inputField value="{!lead.FirstName}" required="false"/>
<apex:inputField value="{!lead.Email}" required="true"/>
<apex:inputField value="{!lead.LastName}" required="true"/>
<apex:inputField value="{!lead.Phone}" required="true"/>
<apex:inputField value="{!lead.Company}" required="true"/>
<apex:inputField value="{!lead.MobilePhone}" required="false"/>
<apex:inputField value="{!lead.Website}" required="false"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Phone" columns="1" >
<apex:inputField value="{!lead.Street}" required="false"/>
<apex:inputField value="{!lead.City}" required="false"/>
<apex:inputField value="{!lead.State}" required="false"/>
<apex:inputField value="{!lead.PostalCode}" required="false"/>
<apex:inputField value="{!lead.Country}" required="false"/>
</apex:pageBlockSection>
</apex:pageBlockSection>
</apex:outputPanel>
</apex:pageBlock>
</apex:form>
</apex:page>
This is a lookuo field and for whatever reason is stopping the page from rerendering. Have you ever seen this issue before?
Thanks