+ Start a Discussion
Sainath VenkatSainath Venkat 

picklist value to default and read only on VF Page

I have a look up field and picklist fields on VF Page,
Look up field is having lookup to Project object, if users selects a Project in lookup field and if Project__c.Account = 'Test' then I want picklist value to be 'No' and disable it.
Can anyone help me out in achieving this on VF Page
AnudeepAnudeep (Salesforce Developers) 
If you are using apex:selectList, you can use disabled attribute and disable the picklist (disabled="{!bool}"/>)

Code snippets below are just samples
public class sample
    public Boolean bool {get;set;}

    public void demo()
            bool = true;
            bool = false;

You can then add a new value to picklist based on the condition
Public List<SelectOption> getCon(){
 List<SelectOption> conOptions = new List<SelectOption>();      
 if(Project__c.Account == 'Test'l){

If you find this information helpful, please mark this answer as Best. It may help others in the community. Thank You!