You need to sign in to do that
Don't have an account?
apex:pageBlock & rerender
I have a <apex:form> and two <apex:pageBlock> in a page.
The reason for having two <apex:pageBlock> is, each get their own <apex:pageBlockButtons>
Here is what my code looks like :
<apex:form >
<apex:pageBlock title="New" mode="edit" id="newPageBlock">
<apex:pageBlockButtons location="top">
<apex:commandButton value="Save" action="{!add}" rerender="current_data"/>
<apex:commandButton value="Cancel" action="{!cancel}" />
</apex:pageBlockButtons>
<apex:pageBlockSection title="new data" columns="1">
........ </apex:pageBlockSection>
</apex:pageBlock>
<apex:pageBlock title="Update" mode="edit" id="current_data">
<apex:pageBlockButtons location="top">
<apex:commandButton value="Save" action="{!add}"/>
<apex:commandButton value="Cancel" action="{!cancel}" />
</apex:pageBlockButtons>
<apex:pageBlockSection title="update data" columns="1">
<apex:outputPanel>
........
</<apex:outputPanel> </apex:pageBlockSection>
</apex:pageBlock>
The idea is to rerender any new data in the update data.
The above code does not work.
My question is can I rerender between page blocks? How would I resolve this problem?
Thanks a million
Hi SBK,
If the code that you posted is exactly what your page contains then you have an error on the closing tag of your outputPanel.
Here is a test page and controller that simulate what you are trying to do, and seem to work fine for me.
<apex:page controller="bTestController"> <apex:form > <apex:pageBlock title="New" mode="edit" id="newPageBlock"> <apex:pageBlockButtons location="top"> <apex:commandButton value="Save" action="{!add}" rerender="current_data"/> <apex:commandButton value="Cancel" action="{!cancel}" /> </apex:pageBlockButtons> <apex:pageBlockSection title="new data" columns="1"> </apex:pageBlockSection> </apex:pageBlock> <apex:pageBlock title="Update" mode="edit" id="current_data"> <apex:pageBlockButtons location="top"> <apex:commandButton value="Save" action="{!add}"/> <apex:commandButton value="Cancel" action="{!cancel}" /> </apex:pageBlockButtons> <apex:pageBlockSection title="update data" columns="1"> <apex:outputPanel> {!timeStamp} </apex:outputPanel> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page> public with sharing class bTestController { public String timeStamp { get { return DateTime.now() + ''; } set; } public PageReference cancel() { return null; } public PageReference add() { return null; } }