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

Rookie question: VisualForce Page on Standard Layout

I have two VisualForce page that use the standard controller. They are essentially identical to each other, except that one has output fields and one has input fields. Right now, I override View and Edit with the appropriate VisualForce page.


Is there any way to embed a VisualForce page onto a standard layout and have it be available for viewing and for editing? I tried embedding a VisualForce page onto the standard layout. It displays fine in view mode, but when I click the Edit button, I can only edit the fields on the standard layout. The VisualForce page disappears entirely. The other half of this question would be how to accomplish this given the available options of apex:outputField and apex:inputField. It seems that this does't lend a single VisualForce page to both viewing and editing.


Embedded visualforce pages are not visible on th edit page of standard page layouts.


To allow viewing and editing from a single visualforce page you could code a portion of the page to only render when a "editMode" variable was set in a custom controller, then set your edit button to trigger a method that toggles that variable and rerenders the page.