I have a custom Visualforce page for a custom object. I have overriden the new
, edit
, and view
buttons to point to this page. I would like to dynamically change the look of the page based on what mode the user is in.
For example, show an <apex:inputField />
when they are editing, but an <apex:outputField />
when viewing:
<apex:outputField value="{!MyCustomObject__c.Field1}" rendered="{!pageMode == 'view'}" />
<apex:inputField value="{!MyCustomObject__c.Field1}" rendered="{!pageMode == 'edit'}" />
I would also use this property to set the mode
attribute of my <apex:pageBlock />
Is there a good way to do this using a button override? I do not want to create custom buttons and use URL parameters if I can avoid it.