Reputation: 31
How do I show an edit button for a custom object in a visual force page and allow the user to edit the custom object?
Upvotes: 0
Views: 1203
Reputation: 186
in your page create a button:
<apex:commandButton action="{!MyEdit}" value="edit">
<apex:params value="{!theIdOfTheRecordToEdit}" name="MyId" assignTo=”{!theId}” />
</apex:commandbutton>
in your controller create a global parameter and an action public String theId {get;set;}
public pagereference MyEdit() {
return(new pagereference('/'+theId+'/e'));
}
The 'magic' is in the '/e' at the end.
Upvotes: 1