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
shan razshan raz 

How to grey out save button on VisualForce

Hi,
I like to render the Submit button on VF page only when Status is not equal to null... Or have it grey out and not grey out on disable. 
I tried this but no luck... Please help. Thank you 
<apex:commandButton value="Submit" action="{!saveChanges}" reRender="errormsg" id="add" status="status" rendered="{!If('{!$Component.status}'==null,false,true)}" />

 
VinayVinay (Salesforce Developers) 
Hi Shan,

Below is the sample code.
<apex:page controller="Sample" sidebar="false">
    <apex:pagemessages />
    <apex:form >
        <apex:commandButton value="Disable" disabled="{!disabl}" action="{!dis}"/>
    </apex:form>
</apex:page>



public class Sample
{
    public Boolean disabl {get;set;}
   
    public void dis()
    {
        disabl = true;
    }
}

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
Vinay Kumar
shan razshan raz
Hi,
Thank you Vinay, but it didnot work for me actually I wanted to do so when Status is selected to enable the button. So I tried something like this but does not work. Do you see where am I going wrong here.. Please see below
thanks
Z
                    <apex:column >
                        <apex:facet name="header">Status</apex:facet>
                            <apex:inputField value="{!s.Status__c}" id="status">
                            <apex:actionSupport event="onchange" reRender="add"/>
                            </apex:inputField>
                    </apex:column> 
<apex:commandButton value="Submit" action="{!saveChanges}" reRender="errormsg" disabled="{!$Component.status==null}" id="add" status="status" />