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
patskepatske 

Override Edit Button with VF Page

Hi Guys, I've written a few VF pages that all work well. I have one that uses a custom controller I have written and would like to use it to override the edit button on a custom object.

However when I go to the custom object and click override on the edit button then select content type = "Visual Force Page"  I can only select VF pages that use that custom object as the 'standardController'.

The page I need to override the Edit Button with uses a customController. Any reason why this is the way it is?

My page with the custom controller kind of edits 3 objects at a time basically displaying the main object they clicked from along with editable related lists of related objects, then updates them on save associating the related objects to the main object they clicked from.

Any reason why I can't select pages with a custom controller when overriding?

Any info would be great.

Thanks,
jwetzlerjwetzler
that is just the requirement for overrides on the view, edit, and new pages.  It is assumed that you will be performing operations/viewing one particular record of that type.

You should use the standard controller for your object, and then use your current controller as an extension. You will need to make a few adjustments to your new extensionto get it to work (you'll need the required constructor, and you can get the id from the controller that's passed in instead of pulling it from the page parameters), but you're going to automatically get all of the standard controller functionality this way.

editing to add:
requiring the standard controller for these pages is a good safeguard that they will be used properly.  it does not introduce any limitations into the pages you can create, because you can always add apex extensions.


Message Edited by jwetzler on 06-12-2008 08:49 PM
patskepatske
sounds good I figured that would be the solution, just wanted to make sure I wasn't missing something.

Thanks again :)
VisualForceVisualForce
Hi..
   Can u post ur final code.. That is very useful for us..