+ Start a Discussion

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.





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}"/> 

You will have to use custom SelectOption my friend!

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