You need to sign in to do that
Don't have an account?
How to include the standard button edit
Hi!
I want to include the standard button "Edit" into my own visualforce page. So, if anybody clicks on the ID of an entry, the relative edit page should open.
My approach:
<apex:pageBlock title="Title">
<apex:dataTable value="{!method}" var="Object" width="100%">
<apex:column >
<apex:facet name="header">ID</apex:facet>
<apex:form >
<apex:commandLink value="{!object.ID__c}" action="{!Edit}"/>
</apex:form>
</apex:column>
</apex:dataTable>
</apex:pageBlock>
The method (in dataTable value) is defined in an apex class and returns a list of several objects with some attributes. One of these attributes is ID__c.
I'm already able to display the ID as normal text, but it isn't shown as commandLink with the action Edit.
Does anybody knows why?
Thanks in advance!
Phil
Hello student;
First, in order to use the standard edit button your page need to have a StandardController.
<apex:page standardController="Opportunity" extensions="MyClass">
Second, if there is no valid Opportunity id (If standardController is Opportunty) in the page URL you still can't see the commandLink.
https://c.ap1.visual.force.com/apex/myPage?id=006xxxxxxxxx
I think now you will be able to view the IDs in your page. But you can't use the link for your purpose because by clicking this link you can edit only the Opportunity which related to the id on page URL(id=006xxxxxxxxx).
Use the Command Link like this-
<apex:commandLink action="{!Edit}">
{!object.ID__c}
</apex:commandLink>
Cool_D
you rather need to use outputlink
<apex:dataTable value="{!method}" var="object" id="pb">
<apex:column>
<apex:facet name = "header">ID</APEX:FACET>
<apex:outputLink value="/{!object.Id__c}"><b>{!object.Id__c}</b></apex:outputLink>
</apex:column>
</apex:dataTable>