1

Hey guys look at my scenario I have a stages(picklist field) in custom object. Requirement is i have to enable my save button only when the stage is 'completed' if the stage is other than 'completed' then only save&new button should be active, how to achieve this.

2 Answers 2

1

In your Controller you can create a property that indicates if the picklist should be enabled.

public boolean stagesDisabled {
    get {
        // Replace stage__c with the correct custom object field reference
        return myCustomObject.stage__c != 'completed';
    }
}

Then, in your Visualforce page you bind this to your commandButtons disabled property.

<apex:commandButton action="{!someAction}" value="Save&new" disabled="{!stagesDisabled}" />
0

Adding to Daniel's answer, in case you need this to work on a standard page layout:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .