+ Start a Discussion
Shwetal DesaiShwetal Desai 

Edit , Delete Button visibility problem in VF page with StandardController

Hi all,

In Visualforce page with StandardController if we use with standard action methods like:
{!edit}
{!delete}
and Value attribute : "Edit" & "Delete"
not being visible.

What could be the problem???

and

Does Clone facility available in such visualforce page??
jeffdonthemicjeffdonthemic
You can use the URLFOR in your onclick handler to achieve this functionality. Notice to the class attribute to give the buttons the Salesforce.com look and feel.

Code:
<apex:pageBlockButtons location="both">
     <apex:commandButton value="Edit" action="{!edit}" />
     <apex:commandButton value="Delete" action="{!delete}" />
     <input type="button" class="btn" value="Clone" onclick="location.href='{!URLFOR($Action.Opportunity.Clone,Opportunity.Id)}'"/>
     <input type="button" class="btn" value="Sharing" onclick="location.href='{!URLFOR($Action.Opportunity.Share,Opportunity.Id)}'"/>
</apex:pageBlockButtons>

 
Jeff Douglas
Informa Plc
blog.jeffdouglas.com
Shwetal DesaiShwetal Desai

Not working ......  :smileysad:

For Edit and Delete buttons i tried these lines:

Code:
 <apex:commandButton value="Edit" action="{!edit}" />
<apex:commandButton value="Delete" action="{!delete}" />

but still these buttons are still not visible on visualforce page

and for clone button

Code:     <input type="button" class="btn" value="Clone" onclick="location.href='{!URLFOR($Action.Employee__c.Clone,Employee__c.Id)}'"/>

here, my custom object name is Employee__c..

this line gives me visualforce error:

Invalid parameter for function URLFOR

pls help to solve this

 


 


 

 

 

jeffdonthemicjeffdonthemic

Something is strange because that code should work. Can you post your entire Visualforce page and controller??

Jeff Douglas
Informa Plc
blog.jeffdouglas.com

 

Shwetal DesaiShwetal Desai

i found something...

When i was creating VF page i have wrote these lines: 

Code:
<apex:page StandardController="Client__c" id="pgclt" extensions="poshistory">
<apex:form id="frmclt">
<apex:pageBlock id="pbclt">
<apex:pageBlockButtons id="btns">
<apex:commandButton value="Edit" action="{!edit}" id="btnEdit" />
<apex:commandButton id="btnCancel" value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>

at these time only "Cancel" button was visible on the page...

but after that when i did override my VF page to the View button of the custom object then both "Edit" & "Cancel" buttons are visible on the page. I dont know why this is happen with Edit / Delete buttons only... coz for Save button and Cancel button its working perfectly..

For "Sharing" & "Clone" :

Code:
<apex:page StandardController="Client__c" id="pgclt" extensions="poshistory">
<apex:form id="frmclt">
<apex:pageBlock id="pbclt">
<apex:pageBlockButtons id="btns">
<apex:commandButton value="Edit" action="{!edit}" id="btnEdit" />
<apex:commandButton id="btnCancel" value="Cancel" action="{!cancel}"/>
<input type="button" class="btn" value="Clone" onclick="location.href='{!URLFOR($Action.Employee__c.Clone,Employee__c.Id)}'"/>
<input type="button" class="btn" value="Sharing" onclick="location.href='{!URLFOR($Action.Employee__c.Share,Employee__c.Id)}'"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page> 

I m not using any controller as i m using StandardController



Message Edited by Shwetal Desai on 11-22-2008 03:11 AM
jwetzlerjwetzler
The edit button probably wasn't visible because you didn't pass an id into your page, which means there's nothing to edit.  The button is going to hide itself if there's no use for it (and also if the user doesn't have the proper Update permission for that object).
Shwetal DesaiShwetal Desai
oh k.........
Thanks for the valuable information.........