1

Strucked with a different kind of Issue.

I'm having three pages page1,page2,page3. I have Included all this pages in a single page by using apex:include like this

<div id="apiaccount" class="tab-pane">
      <apex:include pageName="page1">
</div>
<div id="contactandaccount" class="tab-pane" style="display:none;">
      <apex:include pageName="page2">
</div>
<div id="apiaccount" class="tab-pane" style="display:none;">
      <apex:include pageName="page3">
</div>

and it displays as something like this enter image description here

Now what my problem here is when I click on Update Account Settings in page2,it is redirecting to page1 as I have Pagereference as null. I can't redirect it to page2 since my page2 looks like this without the <div> components beside

enter image description here

and their will be a View change for the users here. I cant add div components to page2 as their will be double values of div reflected When I click on contacts and Accounts tab.Hope the question is clear. What would be the Solution to redirect to page2 without changing the view for the Users

My controller class is

public pagereference update_account(){
      if(condition){
         ApexPages.Message successMsg= new ApexPages.Message(ApexPages.severity.INFO, 'Settings updated successfully');  
            ApexPages.addMessage(successMsg);
       }else{
           ApexPages.Message successMsg= new ApexPages.Message(ApexPages.severity.Error, 'An Error Occured');  
            ApexPages.addMessage(successMsg);
       }

             p = new PageReference('/apex/cnpAccount');
             p.setRedirect(true);
            return null;
}
1

You can use the rerender attribute of the action button to limit the scope of the refresh. In this case you don't want the whole page to refresh, just the area inside your "Account Settings" section. Is that a pageblocksection?
If it is e.g. <apex:pageBlockSection id="AccountSetSection"...
Then your button could include rerender="AccountSetSection"

| improve this answer | |
  • Added Apex class.Here I need to the pagemessages .If I use rerender attribute then it would be not possible na – Eagerin Sf May 23 '13 at 9:43
  • If your pagemessages are contained in another element of the page you can use rerender="AccountSetSection,SectionWithThe PageMessage". This will help you avoid rerendering the full page. – Doug B May 23 '13 at 9:49
  • Can you be a bit more clear on this pls.... – Eagerin Sf May 23 '13 at 10:07
  • You can use a comma separated list of ids in the "rerender" attribute. You don't want to rerender the whole page, but you do need to rerender the area which contains the page messages and any other areas that should change as a result of your update. – Doug B May 23 '13 at 10:41
  • 1
    Only the elements that you specify in "rerender" will be updated. So generally you would specify a PageBlockSection or an OutputPanel or some element containing a chunk of content. Are you sure that the only bit of the screen you want to refresh is that single PageBlockSectionItem? – Doug B May 23 '13 at 11:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.