function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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.........
Tarun Gupta 60Tarun Gupta 60
I created a protected hierarchical custom setting named "TGTest__c". Below is the code snippet to create a record in this custom setting using VF Page.
Can anyone help me with updating the custom settings values? As the below code works fine just the first time and does not save if I require a new value.
 
<apex:page standardController="TGTest__c">
    <apex:form >
        <div>TestMode : <apex:inputField value="{!TGTest__c.TestMode__c}"/></div>
        <div>Username : <apex:inputField value="{!TGTest__c.Username__c}"/></div>
        <div>
        <apex:commandButton action="{!Cancel}" value="Cancel"/>
        <apex:commandButton action="{!save}" value="Save"/>            
        </div>
    </apex:form>
</apex:page>

I tried to add the edit and delete button. However, those buttons don't display. I think I may need to pass the I'd to the standard controller. Though I'm not sure if we could do it to a protected custom setting.
<apex:commandButton action="{!delete}" value="delete"/>
<apex:commandButton action="{!edit}" value="Edit"/>