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
pradeepreddypradeepreddy 

How to create Custom Edit Button on custom visual force page

HI All 

 

i need to create Edit button on my visual force page.In my custom visual force page there are three section. But i need to create Edit custom button on Every section and if i click that Edit button i want to Edit only that section 

 

can you please do some help!

 

 

Niket SFNiket SF

I you what to edit only selected part on Vf page. You need to write a custom logic for that . when you clicked on the edit button just try to rerender the the component that you want editable and other changed as editable.

 

Use Outputfield for those who don't want to be editable.

 

 

Thanks

Nik's

pradeepreddypradeepreddy

Hi 

 

Can u please send me if u have any Edit custom button code so that i can proceed 

 

 

sanjaypatidarsanjaypatidar
VF Page - 

<apex:page standardController="Account" extensions="AccountTest">
    <apex:form>
        <apex:pageBlock title="Main Section">
            <apex:pageBlockSection>
                <apex:commandButton value="edit" action="{!EdittheSection}" immediate="true"/>
            </apex:pageBlockSection>
            
            <apex:pageBlockSection title="Read Only Section" rendered="{!!editSection}">
                    <apex:outputField value="{!Account.Name}"/>
                    <apex:outputField value="{!Account.Name}"/>
            </apex:pageBlockSection>
    
            <apex:pageBlockSection rendered="{!editSection}" title="Edit Section">
                    <apex:inputField value="{!Account.Name}"/>
                    <apex:inputField value="{!Account.Name}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>


Controller  - 

public class AccountTest
    {
    public boolean editSection {get;set;}
        public AccountTest(ApexPages.StandardController controller) 
        {
        
        }
    public PageReference EdittheSection()
        {
        editSection = true;
        return null;
        }
    }

 

Yogesh Bhosale 22Yogesh Bhosale 22
Thank you so much @sanjaypatidar