• Morris Winkler
  • 0 Points
  • Member since 2017

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 1

I'd like to override the standard Save button for Account objects. I know I can't do that directly, so I thought I'd override the Account Edit page, going to a Visualforce page instead, and then override the standard save action in a controller extension.


So I created a new VF page that looks like this:



<apex:page standardController="Account" extensions="AccountEditController">
<apex:detail subject="{!id}" relatedList="true"/>

Then I overrode the Account Edit button to go to this page.


My first problem is that this page displays in view mode, not edit mode. If I click the Edit button, it (of course) just loads the same page again. How do I get the <apex:detail> component to display in edit mode?


My second problem is overriding the standard Save action. I think I can do it with the following in my controller extension:

public class AccountEditController {
private final Account acct;
private ApexPages.StandardController stdController;

public AccountEditController(ApexPages.StandardController stdController) {
this.acct = (Account)stdController.getRecord();
this.stdController = stdController;

public PageReference save() {
// Put my own stuff here

// Do the standard save action
return this.stdController.save();


Is that correct?












  • April 16, 2009
  • Like
  • 0