+ Start a Discussion
SurjenduSurjendu 

what is the VisualForce control to create a drop-down menu?

what is the VisualForce control to create a drop-down menu? I dont see anything like that in the developer guide.
Best Answer chosen by Admin (Salesforce Developers) 
The DevLife.ax318The DevLife.ax318

Swarna,

The tag <apex:selectList  id="recent" size="1" > should render as drop down list (picklist) if the size=1. If you set the size>1, then it will render as a list box.

Randy

All Answers

Ron HessRon Hess
here is one way

<apex:selectList  id="recent" size="1" >
            <apex:actionSupport event="onchange" action="{!changeRt}" reRender="recentmodify"></apex:actionSupport>
            <apex:selectoption itemLabel="Recently Modified" itemValue="mod"></apex:selectoption>
            <apex:selectoption itemLabel="Recently Created" itemValue="cre"></apex:selectoption>
     </apex:selectList>   
     

you can also use
<apex:selectOptions ... data-binding ... etc.


SwarnaSwarna

But this creates a list box, not drop-down(picklist). Is there any other option?

The DevLife.ax318The DevLife.ax318

Swarna,

The tag <apex:selectList  id="recent" size="1" > should render as drop down list (picklist) if the size=1. If you set the size>1, then it will render as a list box.

Randy

This was selected as the best answer
SwarnaSwarna
Thanks Randy.
glorgeglorge

Very useful post.

 

However, this should totally be made explicit in the VisualForce reference document.  :)