• Rachita Jain 15
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

I am developing a custom VF page and added an edit and delete button using the <apex:commandButton action="{!edit}"/>  syntax (see code sample below). For some reason I am not able to view the buttons with this syntex even though I am a system administrator and have also checked that I have the correct privileges to view the buttons.

 

However when I use the urlfor syntax, the edit and delete buttons are displayed. I dont understand why the standard syntex do not display the buttons but using the urlfor syntax does. I have pasted a sample of the code below to demonstrate. Does anyone undestand why one works and the other doesnt ? Thanks in advance.

 

<apex:page standardController="Account" title="Sample Position Layout Page" showHeader="true" sidebar="true" >
   
    <apex:sectionHeader title="{!$ObjectType.Account.label}" subtitle="{!Account.name}"/>
      <apex:form >
      <apex:pageBlock title="Position Detail">
        <apex:pageBlockButtons >
            <apex:commandButton value="Edit" action="{!edit}"/>
            <apex:commandButton value="Edit2" action="{!URLFOR($Action.Account.Edit,Account.Id)}"/>
            <apex:commandButton value="Delete" action="{!delete}"/>
            <apex:commandButton value="Delete2" action="{!URLFOR($Action.Account.Delete,Account.Id)}"/>
            <apex:commandButton value="Sharing" onclick="window.top.location='{!URLFOR($Action.Account.Share,Account.Id)}'" />
        </apex:pageBlockButtons>
       
        <apex:pageBlockSection title="Information" columns="2">
            <apex:outputField value="{!Account.name}"/>
            <apex:outputField value="{!Account.ownerid}"/>                       
        </apex:pageBlockSection>

     </apex:pageBlock>
  </apex:form>
</apex:page>