+ Start a Discussion
Maverick123Maverick123 

Change the default '--None--' from picklist value on visualforce page

Hi Friends,

 

I have few picklist fields rendered from my object on to the visualforce page, when i view them on page, the static value on the picklist is seen as '--None--', which i want to change to '--Select--'.

 

I know this is possible if i am building a new custom ListofOptions field in visualforce but not sure for the standard/custom fields. Please let me know.

 

Thanks,

Maverick

HariniHarini

You can change the default on picklist value by using SelectOptions:

 

public List<SelectOption> getPicklistValues() {
  List<SelectOption> options = new List<SelectOption>();
    options.add(new SelectOption('Select','--Select--'))

 // rest of the code to build a picklist

 

    return options;

}

 

VF Page:

 

         <apex:selectList id="selectList" size="1" multiselect="false" >
                                  <apex:selectOptions value="{!PicklistValues}"/> 
        </apex:selectList>

Rahul_sgRahul_sg
You will have to use custom SelectOption my friend!
Maverick123Maverick123

Thanks Rahul, i guessed that so, but just wanted to confirm if any thing could possibly be done...