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
sales4cesales4ce 

Gray out a Custom Button on VF Page

Hi,

 

I have a VF page that has a custom button called "Send Email".

I have embedded this VF on the custom object page layout.

I am able to send an email and the functionality is working fine.

 

I need to only enable this button based on a field value of the custom object called Status__c.To certain extent i was able to do so using "Rendered" property of the "form" tag(code in red, below). This will either render the button or does not render.

But i want this button to be grayed out  when it does not match the criteria so that users know that they cannot click this and still be able to see the button.

 

Any help on this is highly appreciated. If i am not clear , pls feel free to ask your questions. Thanks!

 

VF Page:

 

<apex:page standardController="echosign_dev1__SIGN_Agreement__c" extensions="sendEmail">
    <apex:form rendered="{!(echosign_dev1__SIGN_Agreement__c.echosign_dev1__Status__c!='Signed')}" >
        <apex:commandButton Value="Send Email" action="{!SendEmail}" />
    </apex:form>
  
</apex:page>
Best Answer chosen by Admin (Salesforce Developers) 
skodisanaskodisana

Hi,

 

Command Button tag is having special attribute 'disabled'.

Declare a Member variable.

Do the logic in your controller code and assign the Value to the member variable either TRUE OR FALSE.

And reRender the VF page.

 

Thanks,

Kodisana

All Answers

skodisanaskodisana

Hi,

 

Command Button tag is having special attribute 'disabled'.

Declare a Member variable.

Do the logic in your controller code and assign the Value to the member variable either TRUE OR FALSE.

And reRender the VF page.

 

Thanks,

Kodisana

This was selected as the best answer
sales4cesales4ce

Kodisana,

 

Thanks for your pointer.It helped me.

 

Sales4ce

anil kumar 151anil kumar 151
How to Gray out a "button which is replaced with a image" in VF Page..???
I mean i have replaced button with an image..and since the disable option working with the normal button and the same funtionalty(disabling the funtionality of calling the method) working with image too but the image is not disabling/grayout from the VF Page