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
AdilewaAdilewa 

Rendered section on edit page after clicking on button on details page

I have a custom button that renders a section into my page.
The button is only visible on the DETAIL (view) page, when I click on it I want it to go to my EDIT page adding the new section. And when it is saved, a checkbox will be changed to true with the new section showing as well.

1. Save new case
2. click on button
3. go back to edit page with new section showing
4. checkbox set to true
5. click on save
6. save case with new section included


MY CONTROLLER----
  public boolean RenderSection{get; set;}
   public Boolean showFields {get; set;}

   public TestController(ApexPages.StandardController controller) {
        RenderSection= false;
   }

  public pageReference ShowFields() {
        RenderSection= true;
        PageReference InputCase = new PageReference('/apex/GADCase?ID='+ApexPages.currentPage().getParameters().get('ID'));
        return InputCase.setRedirect(True);
        
   }



MY APEX PAGE---
<apex:page standardController="Case"  extensions="TestController">      
<apex:form >


<h1>Rerender Section</h1>


<apex:pageBlock >
    <apex:outputPanel id="thePanelWrapper">
        <apex:outputPanel rendered="{!RenderSection}">
             <apex:pageBlockSection columns="2" title="Ticket Fields">
                    <apex:inputField value="{!Case.Financial_Impact__c}"  />
                    <apex:inputcheckbox label="checkbox" value="{!Case.checkbox__c}"  disabled="true"/>

             </apex:pageBlockSection>
        </apex:outputPanel>
    </apex:outputPanel>
</apex:pageBlock>

<apex:commandButton action="{!ShowFields}" 
      rerender="thePanelWrapper"
      value="Submit" 
      onclick="alert('Are you sure you want to escalate to a ticket?');"/>

    
    
</apex:form>
</apex:page>
Chamil MadusankaChamil Madusanka
Let me clear on your requirement. You mean you have a statndard page with that particualr custom button (Edit). When you hi the edit button, the page will be redirected to the editable mode with that particular additional section. After you save the record with new values, that particular section also will be appeared in the detail page. Am I correct with your requirement?

OR

You have a Visualforce page (detail page) with the Edit button.When you hi the edit button, the page will be redirected to the editable mode with that particular additional section. After you save the record with new values, that particular section also will be appeared in the detail page.

Which one?
Pradeep SinghPradeep Singh

Remove reRender attribute from the button and Change "InputCase.setRedirect(True);" to "InputCase.setRedirect(false);" as well. Use condition based on checkbox in 'rendered' if you want to show section everytime you view the page afterwards, else use the same condition you are using.