I have a output view page, and i want to insert a edit command button. when user click on edit button it will enable them to type on output field and save. Can anybody tell me how to do that? Thanks

<apex:page standardController="Product_Brief__c" sidebar="true" showHeader="true" extensions="gibco" ><br/>
<apex:form ><br/>
            <apex:pageBlock mode="inlineEdit"><br/>
            <apex:pageBlockSection collapsible="false" title="Section 1: Custom Media Information (Required)"><br/>
                <apex:outputField value="{!Product_Brief__c.Opportunity__r.Account.Name}"  Label="Company Name"/><br/>
                <apex:outputField value="{!Product_Brief__c.Customer_Number__c}" label="Customer Number"/><br/>
                <apex:outputField value="{!Product_Brief__c.Billing_Address__c}" /><br/>
                <apex:outputField value="{!Product_Brief__c.CreatedBy.Name}"  Label="Contact Name"/><br/>
                <apex:outputField value="{!Product_Brief__c.Shipping_Address__c}"/>

<apex:pageblockButtons ><br/>
                <apex:commandButton action="{!save&view}" value="SAVE"/><br/>
                <apex:commandButton value="PRINT" onclick="window.print();"/><br/>
                <apex:commandButton value="Cancel" action="{!Cancel}"/><br/>
  • Do you really need a button? Why not use inline edit, where for example: you can double click on the output field and it converts to an input field so the value can be changed
    – navD87
    Commented Jun 19, 2015 at 20:11
  • Actually I want a button. Because this is customer facing form, so they want it like a input field. Any idea? Commented Jun 19, 2015 at 20:13
  • For a pure VF solution, if you don't like inlineEdit, you'll need pair of apex:inputField/apex:outputField for every potentially editable fields, conditionally rendered based on whether edit button was clicked or not. The edit button's action tells the controller if clicked
    – cropredy
    Commented Jun 20, 2015 at 0:19
  • Is there one button per field, or will the button make all fields editable at the same time?
    – martin
    Commented Jun 20, 2015 at 8:30
  • Take a look at this question here, it might help point you in the right direction salesforce.stackexchange.com/questions/45432/…
    – Jenny B
    Commented Jun 20, 2015 at 11:30

1 Answer 1


please take a look at this post https://salesforce.stackexchange.com/a/80796/21026 for the requirement was the same as yours.

See you

  • Thank you Julien Gaïotto. it works the way i want it now. Commented Jun 22, 2015 at 15:29
  • Well I didn't see you were the author of the first post haha, sorry for the duplicate answer Commented Jun 22, 2015 at 15:31
  • No problem. Its all good. Commented Jun 22, 2015 at 15:38
  • Hey Julien, I have a another problem. If I have two view page I do I connect each other with this code. I mean when I click edit I would be able to edit both page and save. Do you have any idea? Thanks Commented Jun 23, 2015 at 15:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .